Limma Elist subsetting
2
0
Entering edit mode
arfranco ▴ 130
@arfranco-8341
Last seen 7 months ago
European Union

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 • 1.9k views
ADD COMMENT
0
Entering edit mode
Axel Klenk ★ 1.0k
@axel-klenk-3224
Last seen 3 hours ago
UPF, Barcelona, Spain

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

 

ADD COMMENT
0
Entering edit mode
arfranco ▴ 130
@arfranco-8341
Last seen 7 months ago
European Union

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 COMMENT
1
Entering edit mode

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 REPLY
3
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 395 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6