Question: Subsetting an EList Object doesn't subset $sample.weights
0
gravatar for Steve Pederson
24 months ago by
Australia
Steve Pederson170 wrote:

Hi,

When subsetting an EList object as output by voomWithQualityWeights() there is a list element $sample.weights. When subsetting using the single bracket method, this element returns the initial vector, instead of one that matches the subset. This doesn't seem to be the correct behaviour. Is this able to be fixed?

y <- matrix(rnbinom(10000,mu=5,size=2),ncol=4)
d <- DGEList(counts=y, group=rep(1:2,each=2))
v <- voomWithQualityWeights(d)
v1 <- v[,1:2]
length(v$sample.weights) == ncol(v)
length(v1$sample.weights) == ncol(v1)

Cheers,

Steve

limma voom elist • 474 views
ADD COMMENTlink modified 24 months ago by Gordon Smyth39k • written 24 months ago by Steve Pederson170
Answer: Subsetting an EList Object doesn't subset $sample.weights
0
gravatar for Aaron Lun
24 months ago by
Aaron Lun25k
Cambridge, United Kingdom
Aaron Lun25k wrote:

This does seem like a bug, though subsetting the output of voomWithQualityWeights is unusual. Is there a reason why you use samples 3 and 4 in voomWithQualityWeights but not for the rest of the analysis?

ADD COMMENTlink modified 24 months ago • written 24 months ago by Aaron Lun25k
Answer: Subsetting an EList Object doesn't subset $sample.weights
0
gravatar for Gordon Smyth
24 months ago by
Gordon Smyth39k
Walter and Eliza Hall Institute of Medical Research, Melbourne, Australia
Gordon Smyth39k wrote:

Yes, that's a fair point. The problem is that the list component sample.weights returned by voomWithQualityWeights() is not a recognized component of an EList object, and hence it isn't treated properly by the subsetting operations. The recognized components can be seen from help("EList-class"). EList objects assume that all vectors corresponding to samples (columns of the object) are included in the targets data.frame. 

I have now changed voomWithQualityWeights() so that sample.weights are returned as a column of the targets data.frame. This ensures it will subset properly. If you want to extract the sample weights in future, you will need to use $targets$sample.weights.

The revision has been committed to limma 3.34.5 (release) and limma 3.35.5 (devel).

 

ADD COMMENTlink modified 24 months ago • written 24 months ago by Gordon Smyth39k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 183 users visited in the last hour