Question: DESeq2 lfcShrink with interactions
0
gravatar for rrcutler
2.1 years ago by
rrcutler50
rrcutler50 wrote:

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

ADD COMMENTlink modified 2.1 years ago by Michael Love25k • written 2.1 years ago by rrcutler50
Answer: DESeq2 lfcShrink with interactions
1
gravatar for Michael Love
2.1 years ago by
Michael Love25k
United States
Michael Love25k wrote:

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.

ADD COMMENTlink written 2.1 years ago by Michael Love25k

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)
ADD REPLYlink modified 2.1 years ago by Michael Love25k • written 2.1 years ago by rrcutler50
1

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

ADD REPLYlink written 2.1 years ago by Michael Love25k

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?

ADD REPLYlink written 2.1 years ago by rrcutler50

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).

ADD REPLYlink written 2.1 years ago by Michael Love25k

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

ADD REPLYlink written 2.1 years ago by rrcutler50
1

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.

ADD REPLYlink written 2.1 years ago by Michael Love25k
Please log in to add an answer.

Help
Access

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