# Understanding the different designs in DESeq2

I am using DEseq2 and trying to understand the results obtained using different models.

I have a data design with 2 genotypes and 2 time points.

    sample genotype time
1   WT_S1       WT   T1
2   WT_S2       WT   T1
3   WT_S3       WT   T1
4   WT_S4       WT   T2
5   WT_S5       WT   T2
6   WT_S6       WT   T2
7   KO_S1       KO   T1
8   KO_S2       KO   T1
9   KO_S3       KO   T1
10  KO_S4       KO   T2
11  KO_S5       KO   T2
12  KO_S6       KO   T2


I want to know the differences in results obtained from genotype coefficient and time coefficient when using different models.

Model1) ~ genotype

Since it is comparing the differences in genotype regardless of time , samples 1-6 vs 7-12 are being compared.

Model2) ~ time

This model compares time T2 vs T1 regardless of genotypes. So it is comparing samples (1-3 + 7-9) vs (4-6 +10-12), is this correct?

Model3) ~ genotype + time

My understanding is that this model assumes the genotype effect is the same at both time points and so it adds a time effect to both genotypes.

Does that mean results(obj3, name="genotype_KO_vs_WT") give differences in genotypes by comparing samples 4-6 vs 10-12 ?

What samples are being compared in the results obtained from results(obj3, name="time_T2_vs_T1")? How is it different from model 2?

Model 4) ~ genotype + time + genotype:time

Here I understand results(obj4, name="genotype_KO_vs_WT") gives the differences in genotypes at reference levels ie, samples 1-3 vs 7-9

results(obj4, name="time_T2_vs_T1"). What samples are compared here? How is it different from ‘time_T2_vs_T1’ results in model 2 or model3?

The interaction term as I understand is giving the specific effect due to KO at time T2 controlling for the baseline differences in genotypes. results(obj5, name="genotypeKO.timeT2")

What samples are being compared from the model matrix?

I strongly suggest that you take your normalized counts, get the averages of different groups, and compare those ratios to the different designs.

That said, you might not be able to replicate the fold changes from ~ genotype + time well in Excel. What that design does is basically say "Lots of the variance within each genotype/time point is due to the time point/genotype. Model that so that those differences are taken into account." Whereas a design of just ~ time, the software will go "Oh, there's a lot of variance within each time point". You won't be able to replicate that well in Excel...but that's why you are using DESeq.

That design is probably better than just time or genotype alone, if you want to look at all the KO versus all the WT

Does that mean results(obj3, name="genotype_KO_vs_WT") give differences in genotypes by comparing samples 4-6 vs 10-12 ?

No. The simplest way to do that comparison, and comparisons like it is to make a third data column that's genotype_time, and use contrasts to specify what subgroup to compare to what subgroup.

Here I understand results(obj4, name="genotype_KO_vs_WT") gives the differences in genotypes at reference levels ie, samples 1-3 vs 7-9

Yes. But since that's super confusing, I'd recommend against it. The way I outlined above is far more readable, and should work the same.

The interaction design is best used when you want to see of the changes caused by time are different in the KO than the WT. In theory, you could just generate the two timepoint fold changes, and subtract one from the other, but you'd have no p-value. Using a design with interactions will get you that fold change difference with a p-value.

• Thank you very much for the detailed reply. I want to make sure if I am understanding it correctly. So in the (obj3, name="genotype_KO_vs_WT") from ~genotype+time model, time differences are included as well, is that correct? Also, how is (obj3, name="timeT2vs_T1) in this model is different from just ~time model? Commented Oct 13, 2021 at 21:46
• In the same way. Remember that the order of the elements in the design does not matter at all if you specify what you want in the results command. Commented Oct 13, 2021 at 22:12