Question: DESeq2 error with lfcshrink for interaction term
gravatar for Cece
7 months ago by
Cece0 wrote:

Hi All,

1.   I'm trying to use the code below to shrink the LFCs in my model but I keep generating an error.

resLFCint <- lfcShrink(dds, res = res, name="Cov1.Conditioncase", type="apeglm"))
using 'apeglm' for LFC shrinkage
Error: !missing(coef) is not TRUE

design ~ Age + Gender + Cov3 + Cov2 + Cov1 + Condition + Cov1:Condition

where Cov1, Cov2 and Cov3 are all continuous variables and levels of Condition are treated and untreated. As this is the final coefficient in resultNames(dds), res generates the same results whether or not I actually name the interaction, and gives me around 50 significant genes but this becomes a problem when I try to shrink the LFCs. I'd like to look see if these genes are significant with LFC 1 and -1 and from reading the userguide, it appears that using lfcshrink is recommended over filtering results from res by whatever LFC I set as my cutoff of interest. My aim is to determine whether there is any effect of Cov1 ( and similarly Cov2 and Cov3 - when I get the command to work) that differs between treated and untreated whilst controlling for Age and Gender. I have 24 samples in each set. Please let me know if I'm forming my model correctly given the question I want to answer. 

2.   I'd like to also analyze the situation where I'm adding the effects of Cov1, Cov2 and Cov3 and looking at their additive effects between treated and untreated. I'm not sure if that's the right approach. I can prove that CovX individually have (or do not have) an effect in treated vs untreated if I look at each interaction separately, as above, but is there a way to look at all 3 in one contrast, or naming all in the coefficients?

Thanks in advance,



deseq2 interaction term • 241 views
ADD COMMENTlink modified 7 months ago by Michael Love23k • written 7 months ago by Cece0
Answer: DESeq2 error with lfcshrink for interaction term
gravatar for Michael Love
7 months ago by
Michael Love23k
United States
Michael Love23k wrote:

The error is saying that the 'coef' term wasn't specified. lfcShrink() uses an argument 'coef' instead of 'name' which is used by results().

If you want to test multiple coefficients at once, you should use the LRT. You remove the terms from the reduced design that you want to test. See the vignette section on LRT.

ADD COMMENTlink written 7 months ago by Michael Love23k

So if I understand correctly, if my full design looks like this:

ds <- DESeqDataSetFromMatrix(countData = mycounts, colData=merge2, design= ~ Age + Gender + 
                                Cov3 + Cov2 + Cov1 + Condition + Cov1:Condition + Cov2:Condition + Cov3:Condition)

then I can test the effect of the interaction between  Cov1 and Condition by:

dds <- DESeq(dds, test="LRT", reduced=~Cov1:Condition)

and test the additive effect of the three interactions by doing

dds <- DESeq(dds, test="LRT", reduced=~Cov1:Condition Cov3:Condition + Cov2:Condition)

Is that correct? 

Many thanks

ADD REPLYlink written 7 months ago by Cece0

The reduced design should be the null model. You remove only the coefficients of interest. Above it looks like you are including only the coefficients of interest. Read over the LRT section again maybe?

ADD REPLYlink written 7 months ago by Michael Love23k

Hi Michael,

I eventually simplified my design to run:

dds_full <- DESeq(countData = mycounts, colData=merge2, design= ~ Age + group + Cov1 + Cov2)
dds_red <-DESeq(dds_full, test = "LRT", reduced = ~ Age + group + Cov1)

So I just want to be certain that under these conditions, I'm looking at the effect of covariate 2 on the model. From the results table, the log2foldchanges are for Cov2. The pvalues generated are for the differences between the two groups: ~ Age + group + Cov1 + Cov2 vs. ~ Age + group + Cov1. If these pvalues/ padj are basically the same as for the full model (Age + group + Cov1 + Cov2), then I can assume that Cov2 has no particular effect on/ contribution to the model, correct? I'm a bit worried about my interpretation of the reduced model results table since it appears to be identical to the results table for the full model. Thanks

ADD REPLYlink written 25 days ago by Cece0

I think you are confused about the LRT procedure. If the description in the DESeq2 vignette is not clear, you may want to discuss with a statistician.

You don’t need to run DESeq() twice, you only run the second line above, which fits both a full and reduced model and compares them.

ADD REPLYlink written 23 days ago by Michael Love23k

Sorry Michael,

That was a typo. DESeq should have been DESeqDataSetFromMatrix(countdata...) to set up my dds_full object.

ADD REPLYlink written 22 days ago by Cece0

Got it. For further interpretation of the LRT here I’d recommend to discuss with a statistician.

ADD REPLYlink written 22 days ago by Michael Love23k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 154 users visited in the last hour