DESeq2 lfcShrink with interactions
1
0
Entering edit mode
rrcutler ▴ 50
@rrcutler-10667
Last seen 19 months ago

Hello fellow DESeq2 users,

Using the example given in the vignette regarding interaction terms, I am unable to output a results table where the log2 fold changes are shrunken using lfcShrink(). I tried using the 'contrast' and 'coef' arguments but have had luck with neither. I also tried using 'coef=8', as this is the number of coefficients in resultsNames(dds)

Code:

colData <- as.data.frame(cbind(condition, genotype))

rownames(colData) <- colnames(countData)

dds <- DESeqDataSetFromMatrix(countData = countData, colData   = colData, design  = ~ genotype + condition + genotype:condition)

dds <- DESeq(dds, fitType='local')

resultsNames(dds)

[1] "Intercept"              "genotype_II_vs_I"       "genotype_III_vs_I"

[4] "condition_B_vs_A"       "genotypeII.conditionB"  "genotypeIII.conditionB"

res <- results(dds, contrast = c("genotype", "II", "I" )) #equivalent to res <- results(dds, name="genotype_II_vs_I" )

resLFC <- lfcShrink(dds, contrast = c("genotype", "II", "I" ), res=res)

Error in averagePriorsOverLevels(objectNZ, betaPriorVar) :

  beta prior for genotypeI.conditionA,genotypeII.conditionA,genotypeIII.conditionA,genotypeI.conditionB is not greater than 0

resLFC <- lfcShrink(dds, coef=2, res=res)

Error in designAndArgChecker(object, betaPrior) :

  betaPrior=FALSE should be used for designs with interactions

I know by default the betaprior=FALSE, so I am not sure about the second error. How can I get the shrunken LFC as I do when making pairwise comparisons?

-R

deseq2 interactions logfoldchange • 1.6k views
1
Entering edit mode
@mikelove
Last seen 23 hours ago
United States

We haven't had support for shrinkage LFC estimators for designs with interactions for a while, although I hope to have a working implementation in this devel cycle (so release by October). So you'll have to check in later for this, sorry. The alternative to shrinkage is to remove the genes with low mean counts for the MA plot.

0
Entering edit mode

Hi Michael,

Thanks for the response. I look forward to seeing that functionality in the new release. For now, wouldn't it be the same if I instead used a group design where I made the same pairwise comparison as above and then used lfcShrink()?

Code:

colData <- as.data.frame(cbind(condition, genotype))

rownames(colData) <- colnames(countData)

dds$group <- factor(paste0(dds$genotype, dds\$condition))

dds <- DESeqDataSetFromMatrix(countData = countData, colData   = colData, design  = ~ group)

dds <- DESeq(dds, fitType='local')

res <- results(dds, contrast = c("group", "IIA", "IIB"))

resLFC <- lfcShrink(dds, contrast = c("group", "IIA", "IIB"), res=res)
1
Entering edit mode

Yes, if you want to compare individual groups, this is a perfectly valid approach.

0
Entering edit mode

I have noticed before that the results of using these two different design approaches have minor variations when looking at equivalent comparisons. Is there a brief explanation for this?

0
Entering edit mode

You mean the group based analysis with shrinkage compared to the interaction term without shrinkage? Or both without shrinkage? The latter can be just numeric convergence differences (likelihood doesn't change more in relative amount than a threshold so the iterative method stops).

0
Entering edit mode

Yes, I meant the latter. Could you explain what you mean by numeric convergence differences?

1
Entering edit mode

Two numbers not being equal to all decimal places, because the differences in that number (say the coefficient) was within the tolerance of the iterative algorithm with respect to changes in the objective.