[BioC] converting data into logical matrix

Sean Davis sdavis2 at mail.nih.gov
Fri Nov 4 12:36:02 CET 2005


On 11/4/05 4:32 AM, "Assa Yeroslaviz" <Assa.Yeroslaviz at uni-duesseldorf.de>
wrote:

> Hey,
> 
> I have a difficult question(for me at least).
> 
> I did the sam calculation and got the data i wanted. First i have a matrix
> with
> double values (last.out)
>> last.out<- sam(last.data, AE0625419.cl, B=20,
>> gene.names=matrix_all_names[,2])
> 
> After i cut out the lines with 'NA'-values for the p-values
>>       scores            <- log(pmax(last.out at p.value))
>> valids        <- !is.na(scores)
>> scores        <- scores[valids]
>> data        <- last.data[valids,]
> 
> I have a list of data (18 Columns x 19,302 rows)
> I then added the p-values as a 19th column to the list
>>      data[,19]    <- scores
> 
> Afterwards I've searched for the significant genes (delta =10)
>>       sig        <- list.siggenes(last.out, 10)
> 
> subsequent I deduced the data matrix to the few genes which were significant.
>>       data_end    <- last.data[sig,]
> 
> Now I come to my problem(s):
> 
> 1. I would like to have my p-Values also in the last data matrix. Somehow I
> lose
> these values while minimizing the matrix.
> the data file is than again with only 18 columns.
>> dim(data_end)
> [1]  6 18
> 
> But if i add the scores afterwards then the list is too long, because i have
> only 6 rows (and not 19,302).
> 
> Can you help me?

If the order of what you give above is correct, then "scores" was never part
of last.data and there is no reason to expect that indexing last.data is
going to somehow include "scores"--they were haver added.  If I understand
what you are doing and want to do, just do:

 scores <- log(pmax(last.out at p.value))
 data <- cbind(last.data,scores)
 data.end <- data[sig,]


> 2. My second problem is a bit bigger.
> 
> I would like to convert my first data file (data) into a logical matrix, with
> TRUE for the rows which are in the object sig( the significantly expressed
> genes) The other rows should be FALSE
> I nthis case it should look like a matrix with 19,302 rows, whereas 6 rows
> have
> TRUE in all 18 columns and all the rest have FALSE ( I would be happy to do it
> also with 0=FALSE and 1=TRUE, but I then have the same problem.)
> 
> It would be really nice if someone can help me with this two cases.

 mynewmatrix <- matrix(FALSE,nr=19302,nc=18)
 mynewmatrix[sig,] <- TRUE

Just out of curiosity, why do you want to do this?  It contains no more
information than sig by itself?

Sean



More information about the Bioconductor mailing list