Limma-voom with external observation weights
1
2
Entering edit mode
@peter-langfelder-4469
Last seen 9 weeks ago
United States

I'd like to use limma-voom to do a differential expression analysis on RNA-seq data using "my own" (i.e., external for limma) observation weights that downweigh outliers and which are different from voom weights. (I have a way to calculate the weights, that's not the issue). The user's guide and help files do not mention the possibility of using observation weights with voom; reading the code of lmFit, it seems to me that lmFit will disregard voom weights if I specify observation weights using argument weights. If this is not correct, please correct me.

If voom weights and the argument 'weights' indeed conflict in the lmFit function, assuming that the voom and my own weights are independent, can I simply multiply the 'weights' component of the output of voom with my own weights? (From reading voom code, a simple multiplication is used when sample weights are supplied, so hopefully this is not an outlandish proposition...)

limma limma-voom • 1.3k views
2
Entering edit mode
@gordon-smyth
Last seen 12 minutes ago
WEHI, Melbourne, Australia

voom() accepts any argument that lmFit() does via the '...' argument and, yes, to use both voom weights and external weights in downstream functions, just multiply them. To input external apriori weights to voom:

v <- voom(y, design, weights=your.external.weights)
v$weights <- v$weights * your.external.weights
fit <- lmFit(v, design)


etc. Or, to avoid overwriting the voom weights, you could instead use:

v <- voom(y, design, weights=your.external.weights)
fit <- lmFit(v, design, weights = v\$weights * your.external.weights)


and this would be equivalent. The fact that the 'weights' argument to lmFit(), when set, takes precedence over the weights stored in 'v' is documented on the lmFit help page -- you don't need to dive into the code.

Alternatively, if your library sizes are not too different, you might be able to use the limma-trend pipeline instead. That would bypass voom and just use your external weights directly.

0
Entering edit mode

Thanks! If I may ask a second question, for designs without replicates (e.g., when there's a continuous covariate), is limma-voom a more appropriate option than edgeR or similar approaches that need dispersion estimation for each condition? Voom seems to use a single mean-variance function (for all genes and all conditions), so having no replicates would not seem to be a problem.

0
Entering edit mode

There is no problem at all with continuous covariates for either limma or edgeR. Either would be entirely appropriate.

You're jumping to some incorrect assumptions here. Having a continuous covariate is not the same as having no replicates and edgeR does not need to estimate a separate dispersion for each condition. Linear models (or generalized linear models in the case of edgeR) subsume all these possibilities elegantly without any difficulties.

If you really did not have replicates at all (meaning that the rank of the design matrix is equal to or greater than the number of samples) then you cannot use limma or edgeR in the normal way.

0
Entering edit mode

Thanks for the clarification.