This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DESeq2 error while using apeglm - optimHess

I am trying to generate the lfcshrinkage using apeglm and it gives me the following error:

>  resApeglm <- lfcShrink(dds, coef=2, type="apeglm")

Error in optimHess(par = init, fn = nbinomFn, gr = nbinomGr, x = x, y = y,  : 
  non-finite value supplied by optim

Assuming that the dispersion is causing issues with the lfcshrinkage estimation, I have used ashr and that worked fine. But want to understand why the optimization step failed when I used apeglm ?

optimhess apeglm deseq2

Please get used to provide command lines/code and if possible a MRE.

I got the same issue. Please let me know if you get solved it.

While understandable in its motivation, posts like this do not help. The issue at hand is still not reproducible. Please provide anything to debug. We neither know what data you're running, nor the full code or even the DESeq2 and Bioconductor versions. Providing a representative dataset would help, so does code and sessionInfo, for example via a reprex.

I have the exact same problem. I was using DESeq2 1.24.0 with R 4.0.2 before and everything worked fine. Recently I updated to R4.3.0 and DESeq2 1.40.1 and get the same error with data and code which was working fine before. The error seems to be not specific for apeglm as there are reports for other packages as well. In addition, the error pops up only after some time during the LFC shrinkage using apeglm but not ashr.

1 answer

Please follow https://support.bioconductor.org/p/9151819/ for the response of the DESeq2 author. I posted a reproducible example there.

Edit: Solved in apeglm. Either get the current version via devtools::install_github("azhu513/apeglm") or wait until the fix is pushed to Bioc release.

Log in to answer this question.