Hi Mike,
According to the DESeq2 lfcShrink()
documentation, it appears that the function should work when you provide a DESeqDataSet
(dds
) and corresponding DESeqResults
(res
) generated using the standard DESeq() %>% results()
approach, correct? On BioC 3.8 (v1.22.2), I'm seeing this error return:
lfcShrink(dds = dds, res = res)
# using 'normal' for LFC shrinkage, the Normal prior from Love et al (2014).
# additional priors are available via the 'type' argument, see ?lfcShrink for details
Error in results(dds.shr, name = coefAlpha, lfcThreshold = lfcThreshold) :
object 'coefAlpha' not found
Calls: lfcShrink -> results
Backtrace:
█
1. └─DESeq2::lfcShrink(dds = dds, res = res)
2. └─DESeq2::results(dds.shr, name = coefAlpha, lfcThreshold = lfcThreshold)
It seems like the coefAlpha
value isn't passing through correctly to results()
internally. If I run lfcShrink()
using a coef
or contrast
argument, then the function works as expected. Also, it's a little confusing keeping coef
here, since results()
now only supports a name
string (corresponding to coef inresultsNames()
) or a contrast
vector. This seems to still be the case in v1.23 on GitHub: lfcShrink.R. Should that be updated to use name
instead to match results()
?
HI Mike,
I get the same error message when I try to use lfcShrink with type="ashr" and previously calculated results if I used a more complex contrast in the call to "results". I've replicated the problem with the "pasilla" dataset used in the DESeq2 vignette. Is there a way to do this, or would I be better off just making a new model to test this particular contrast (i.e., ~ condition + type)?
load pasilla dataset:
make a grouping factor to allow comparisons between different combinations of condition and type:
test for overall effect of type:
this works:
this does not:
The second argument of
lfcShrink
iscoef
. If you call a function in R without naming it, it assumes you are giving them in order of the function definition.Try adding
res=
in front ofz
.Awesome! I can't believe I overlooked that!
Jason, try passing in a
coef
orcontrast
argument along with theres
in yourlfcShrink()
call.Hi Michael,
I know how to pass a contrast for a simple comparison between two groups.
But if I want to do a contrast like I wrote above that requires the use of "listValues", I'm stuck because I don't know how to pass that parameter to "lfcShrink"
I should also add that this is a bit of a toy example. I'm actually trying to do this with 3 population x 3 treatments design.