Entering edit mode
I would like to test differential gene expression in two groups of genotypes using genotypes nested within groups as a random effect. All genotypes measured in 2 treatments.
I understand that I can specify nested effect
dds <- DESeqDataSetFromMatrix(countData,
colData,
design= ~ treatment + group + group:treatment + group:genotype)
and this will test treatment and group as main effects and their interaction, but will group be tested against genotypes within groups?
Thanks!
I'm sorry, but this is a software question. If one specifies a nested effect as described in http://www.bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#model-matrix-not-full-rank, like this:
grp ind cnd ind.n
1 X 1 A 1
2 X 1 B 1
3 X 2 A 2
4 X 2 B 2
5 X 3 A 3
6 X 3 B 3
7 Y 4 A 1
8 Y 4 B 1
9 Y 5 A 2
10 Y 5 B 2
11 Y 6 A 3
12 Y 6 B 3
and then uses grp:ind.n term in the design, this creates a crossed (interaction) term in the model, wrongly assuming that ind 1 in grp X is somehow related to ind 4 in grp Y, etc. If ind are truly nested in grp this is definitely not right.
So, I am correct that nested effects cannot be specified in DESeq2 design?
They are separate coefficients and not related in any way. Create the design matrix and take a look at the columns.