Question: Limma Elist subsetting
0
3.0 years ago by
arfranco130
European Union
arfranco130 wrote:

I am running a microarray analysis using limma containing some spike-in controls that allowed me to know that I got a linear signal response with a data$E >= 2.3, where data is a EList class object (data is microarray data already substracted and normalized), and data$E contains the intensity signal

Then, I tried to subset the data

data <- data[data$E >= 2.3] But I got an error Error: Two subscripts required However if I run > head(data$E >= 2.3)
A    B    C    D    E    F
[1,] TRUE TRUE TRUE TRUE TRUE TRUE
[2,] TRUE TRUE TRUE TRUE TRUE TRUE
[3,] TRUE TRUE TRUE TRUE TRUE TRUE
[4,] TRUE TRUE TRUE TRUE TRUE TRUE
[5,] TRUE TRUE TRUE TRUE TRUE TRUE
[6,] TRUE TRUE TRUE TRUE TRUE TRUE

Any clue on how can I subset the data ?

microarray limma subsetting • 654 views
modified 3.0 years ago • written 3.0 years ago by arfranco130
Answer: Limma Elist subsetting
0
3.0 years ago by
Axel Klenk920
Switzerland
Axel Klenk920 wrote:

data$E >= 2.3 specifies the rows you want to select but you need to specify the columns as well. If you want all columns: data[data$E >= 2.3, ]

notice the "," -- one-character error :-)

Cheers,

- axel

Answer: Limma Elist subsetting
0
3.0 years ago by
arfranco130
European Union
arfranco130 wrote:

I forgot to mention I tried that solution as well, but it is not working (is not subsetting)

subset <- data[data$E >= 2.3,] Error in object[[a]][i, j, drop = FALSE] : (subscript) logical subscript too long ADD COMMENTlink written 3.0 years ago by arfranco130 1 sorry for not checking my answer... data$E is a matrix and not a vector...

so, exactly what do you want to subset? only rows with all values >= 2.3, e.g.

data[apply(data$E, 1, function(x) all(x >= 2.3)), ] should do that; and there is package genefilter for more complicated things. ADD REPLYlink written 3.0 years ago by Axel Klenk920 3 Or, more elegantly and quickly: data[rowSums(data$E >= 2.3) == ncol(data$E),] # rows with all values >= 2.3 data[rowSums(data$E >= 2.3) > 0,] # rows with any value >= 2.3
data[rowSums(data\$E >= 2.3) == 2,] # rows with exactly 2 values >= 2.3

... and so on, for any number of values that you'd like to be greater-than-or-equal-to 2.3 per row.

ADD REPLYlink modified 3.0 years ago • written 3.0 years ago by Aaron Lun24k