Hi, Dr Love. I am little confused about the example in ?results. The example3 in ?results is listed below
## Example 3: two conditions, three genotypes
# ~~~ Using interaction terms ~~~
dds <- makeExampleDESeqDataSet(n=100,m=18)
dds$genotype <- factor(rep(rep(c("I","II","III"),each=3),2))
design(dds) <- ~ genotype + condition + genotype:condition
dds <- DESeq(dds)
> resultsNames(dds)
[1] "Intercept" "genotype_II_vs_I"
[3] "genotype_III_vs_I" "condition_B_vs_A"
[5] "genotypeII.conditionB" "genotypeIII.conditionB"
# the condition effect for genotype I (the main effect)
results(dds, contrast=c("condition","B","A"))
# the condition effect for genotype III.
# this is the main effect *plus* the interaction term
# (the extra condition effect in genotype III compared to genotype I).
results(dds, contrast=list( c("condition_B_vs_A","genotypeIII.conditionB") ))
# the interaction term for condition effect in genotype III vs genotype I.
# this tests if the condition effect is different in III compared to I
results(dds, name="genotypeIII.conditionB")
# the interaction term for condition effect in genotype III vs genotype II.
# this tests if the condition effect is different in III compared to II
results(dds, contrast=list("genotypeIII.conditionB", "genotypeII.conditionB"))
Forgive my little konwledge about model.matrix. I haven't figured model.matrix
out yet.
According to these example, I thinks the contrast=c("condition","B","A")
means genotypeIB(or I say IB) - genotypeIA(or I say IA).
And the name=genotypeIII.conditionB
means (IIIB - IIIA) - (IB - IA).
And according to the above explanation, the results(dds, contrast=list("genotypeIII.conditionB", "genotypeII.conditionB"))
will means [(IIIB - IIIA) - (IB - IA)] - [(IIB - IIA) - (IB - IA)] = (IIIB - IIIA) - (IIB - IIA)
. which same as this word this tests if the condition effect is different in III compared to II
But If I apply this explanation to results(dds, contrast=list( c("condition_B_vs_A","genotypeIII.conditionB") ))
, this will not make sense. this will become (IB - IA) - [(IIIB - IIIA) - (IB - IA)] = 2(IB - IA) - (IIIB - IIIA).
Thanks for your reply Dr. Love. I just want to know if my explanation about the design is right or there are more complex explanation should be considered.
Like
results(dds, contrast=c("condition","B","A"))
will means IB - IAresults(dds, name="genotypeIII.conditionB")
will means (IIB - IIA) - (IB - IA).I think it will help me understand better the vignette or question about design about DESeq2.
The meaning depends on the design actually. And I unfortunately don’t have sufficient time to go through these on the support site.
I’d also recommend to check out ExploreModelMatrix — this is a new Bioconductor package to help explain what coefficients mean for various designs.
Thanks again :). I will see the ExploreModeMatrix.