I'm trying to incorporate lfcShrink into my DESeq2 analysis and I'm running into a problem with the coef
argument in lfcShrink.
I performed an experiment with 4 cell lines, treated and untreated, in biological triplicate, for a total of 24 samples. I can use
results(dds, contrast = c("condition", "cell.line.2.treated", "cell.line.2.untreated"))
and get my DGE results and downstream analysis is fine.
My problem arises when trying to use lfcShrink. This forces me to use the coef
argument, but when I look at the options in resultsNames
, all of the comparisons are with cell.line.1.untreated
, e.g.
condition_cell.line.2.treated_vs_cell.line.1.untreated
condition_cell.line.2.untreated_vs_cell.line.1.untreated
condition_cell.line.3.treated_vs_cell.line.1.untreated
condition_cell.line.3.untreated_vs_cell.line.1.untreated
which isn't what I need for my analysis.
I've tried looking into setting the base condition in the DESeq object without any luck. The only thing I can think of doing is setting cell.line.2.untreated
as the first level within my colData
object, but I'm thinking there's a better way of doing this.
I tried running lfcShrink
with contrast
instead of coef
and get this error:
Error in lfcShrink(dds, contrast = c("condition", "cell.line.2.treated", "cell.line.2.untreated"), :
type='apeglm' shrinkage only for use with 'coef'
To my knowledge setting the factor level is the only way to accomplish this with apeglm.
use
relevel
to specify the reference level for this factor: http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#note-on-factor-levelsor use
ashr
shrinkage method which I think usescontrast
instead ofcoef
.For more info see http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#extended-section-on-shrinkage-estimators