I have a 3-factor experiment, each factor having two levels:
- gt: Genotype: XX vs XY
- sex: Sex: M vs F
- tmt: Treatment: Letrizole (let) vs Vehicle (veh)
I'm interested in the following contrasts:
- Average main effects of genotype, sex, and treatment across all other levels of other factors
- Interaction effect of gt:tmt across all levels of sex
- Interaction effect of sex:tmt across all levels of gt
Then similarly, getting the same information slicing across one or the other level of gt and sex. That is,
- Avg main effects of gt and tmt separately in each level of sex (m and f)
- Avg main effects of sex and tmt separately in each level of gt (xx and xy)
- Interaction of gt:tmt separately in each level of sex (m and f)
- Interaction of sex:tmt separately in each level of gt (xx and xy)
Here's what I'm doing.
I have a design matrix that looks like this, and after running the DESeq pipeline, I have 6 contrasts in my results set.
> design(dds) ~gt + tmt + sex + gt:tmt + sex:tmt > matrix(resultsNames(dds)) [,1] [1,] "Intercept" [2,] "gt_xy_vs_xx" [3,] "tmt_let_vs_veh" [4,] "sex_m_vs_f" [5,] "gtxy.tmtlet" [6,] "tmtlet.sexm"
And here's what I'm doing to try to get out the main effects. Does this look right?
# average main effects across all levels: get the main effect and half of both contrasts # for gt xy vs xx results(dds, contrast=c(0, 1, 0, 0, .5, .5)) # for tmt let vs veh results(dds, contrast=c(0, 0, 1, 0, .5, .5)) # for sex m vs f results(dds, contrast=c(0, 0, 0, 1, .5, .5))
However, I'm confused about interaction terms. If I want the average gt:tmt interaction across all levels of sex, do I include "half" the interaction of sex:tmt also so I capture this across all levels of sex? Or not? which of these is correct?
results(dds, contrast=c(0, 0, 0, 0, 1, .5)) results(dds, contrast=c(0, 0, 0, 0, 1, 0))
And for the second set of results, getting the same information slicing across one or the other level of gt and sex, I'm guessing it'll look something like this?
# main effect of gt xy vs xx in females average across treatment: # add half the gt:tmt interaction? results(dds, contrast=c(0, 1, 0, 0, .5, 0)) # main effect of gt xy vs xx in males average across treatment: # add half the gt:tmt interaction, and all of the tmt:sex(m) interaction? results(dds, contrast=c(0, 1, 0, 0, .5, 0)) results(dds, contrast=c(0, 1, 0, .5, 1))
I think if I can get these few correct I can handle the rest.
Thanks for any insight!
Also, an older version of the DESeq2 manual has a description of using numeric contrasts, which seems to have completely disappeared from the newer version of the manual. See page 25 here:
https://www.bioconductor.org/packages/3.1/bioc/vignettes/DESeq2/inst/doc/DESeq2.pdf
For standard model matrices, to obtain the “average condition effect” for both sets, we can use a numeric contrast, assigning a 1 to the main effect conditionB and a 0.5 to the interaction effect setY.conditionB, as they appear in resultsNames(dds). This can be understood as taking us halfway from the condition effect in set X to the condition effect in set Y: