Subsetting an EList Object doesn't subset $sample.weights
2
0
Entering edit mode
@steve-pederson-3490
Last seen 24 months ago
Australia

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

voom EList limma • 1.1k views
ADD COMMENT
0
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 6 minutes ago
The city by the bay

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 COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 4 hours ago
WEHI, Melbourne, Australia

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 COMMENT

Login before adding your answer.

Traffic: 772 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