I'm trying to run a straightforward Wald test in DESeq2
and was a little surprised to see that fold changes and standard errors are no longer shrunken by default. I know I can still compute moderated values using the lfcShrink()
function, but I see no straightforward way to:
a) calculate the corresponding test statistics and p-values; or
b) implement the gene filtering, LFC thresholding, hypothesis testing, and/or p-value adjustment options implemented in results()
to these shrunken estimates.
It's especially weird that test statistics and p-values are calculated from raw rather than moderated values even when running lfcShrink()
. For instance:
dds <- makeExampleDESeqDataset()
dds <- DESeq(dds)
res <- results(dds)
shrunk <- lfcShrink(dds)
# Fold changes and SEs are different
identical(res$log2FoldChange, shrunk$log2FoldChange)
# [1] FALSE
identical(res$lfcSE, shrunk$lfcSE)
# [1] FALSE
# But test statistics and p-values are the same
identical(res$stat, shrunk$stat)
# [1] TRUE
identical(res$pvalue, shrunk$pvalue)
# [1] TRUE
Of course it's fairly simple to calculate moderated z-scores (z <- shrunk$log2FoldChange / shrunk$lfcSE
) and two-sided p-values (p <- 2 * (1 - pnorm(abs(z)))
) from the lfcShrink()
output, but it's confusing that the function doesn't do so by default or include an option to do so automatically.
Moreover, it would be nice to incorporate some of the helpful functionalities of results()
into lfcShrink()
. I'm thinking specifically about the ability to specify filter methods and LFC thresholds, perform one-sided tests, etc. Again, it's not impossible to do all this oneself, but I don't see why it shouldn't be part of the package anymore. Is there some simple way to recombine the two functions or at least extend the same options to both? Or are there good reasons why these options were removed that I'm just failing to appreciate?
Hi Michael,
Thanks so much for the prompt and informative reply. I didn't realise that setting
betaPrior = TRUE
ensures back compatibility when runningresults()
, so that's especially helpful. I recently read the Stephens paper and am very interested to see how local false sign rates may improve analyses moving forward. These alternative shrinkage methods sound promising! I also totally appreciate that this is a fast evolving piece of software, and it must be a real challenge to be constantly updating code and documentation, not to mention answering questions from confused users like myself. Thanks again for all your help!Thanks. Feel free to post Qs as they come up, and I'll probably post another lfcShrink() thread when we've added the new functionality, like arbitrary posterior areas. Also need to update plotMA() to know about s-values, and probably to have different coloring to indicate the difference.
My priority is to get the functions and man pages correct, and then hopefully vignette sections follow soon after, but they do take a while to write well.