This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DESeq2 lfcShrink(...,type="apeglm") giving different results table than results(...)

I am trying to figure out which shrinkage estimater the current DESeq2 version is using in the results(..) function.

The original 2014 paper describes that an adaptive Normal distribution is used as a prior, and the current vignette explains the newly avaiable shrinkage estimators (the new default is apeglm):

In DESeq2 version 1.18, we include two additional adaptive shrinkage estimators, available via the type argument of lfcShrink. For more details, see ?lfcShrink

The options for type are:

apeglm is the adaptive t prior shrinkage estimator from the apeglm package (Zhu, Ibrahim, and Love 2018). As of version 1.28.0, it is the default estimator.

ashr is the adaptive shrinkage estimator from the ashr package (Stephens 2016). Here DESeq2 uses the ashr option to fit a mixture of Normal distributions to form the prior, with method="shrinkage".

normal is the the original DESeq2 shrinkage estimator, an adaptive Normal distribution as prior.

However, I noticed following result tables giving me very different different Log2-FCs for following variables.

res <- results(dds,contrast=c("treatment","1_microM_48","1_microM_24"))

resSLFC <- lfcShrink(dds,coef="treatment_1_microM_48_vs_1_microM_24",type="apeglm",res=res)

Has anyone else noticed this? Any help is greatly appreciated!

rna-seq deseq2

1 answer

results() alone does not do any logFC shrinkage. So you are comparing unshrunken with shrunken logFCs with the above code. WIth lfcShrink you then have the three options as you listed above.

If I run deseq with the betaPrior=TRUE option, then the prior used in apeglm packages would be used?

So where is the difference between res and resSLFC in following example:

dds <- DESeq(dds,betaPrior=TRUE)

res <- results(dds,contrast=c("treatment","1_microM_48","1_microM_24"))

dds <- DESeq(dds,betaPrior=FALSE)

res1 <- results(dds,contrast=c("treatment","1_microM_48","1_microM_24"))

resSLFC <- lfcShrink(dds,coef="treatment_1_microM_48_vs_1_microM_24",type="apeglm",res=res1)

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

Thank you!

I am new to biostars, thank you for pointing that out!

This option is (from what I understand) a legacy option from the time when the shrinkage was part of the standard workflow via DESeq(). These days one should use the lfcShrink function as clearly described in the manual, and I strongly suggest you follow it. So DESeq() with default setting, then results() and then lfcShrink with one of the three options as you like.

Log in to answer this question.