DESeq2 Design Matrix Two Conditions and Two Treatments
Entering edit mode
OST • 0
Last seen 5 months ago
United States


I kindly ask for help comparing the interactions terms between two groups. I have two groups (two conditions/types) and two treatments. the meta data is as follows

  sample              type treatment
1  Control_ND_1 Control        ND
2  Control_ND_2 Control        ND
3  Control_ND_3 Control        ND
4  Control_ND_4 Control        ND
5   Control_D_1 Control         D
6   Control_D_2 Control         D
7   Control_D_3 Control         D
8   Control_D_4 Control         D
9  Injured_ND_1 Injured        ND
10 Injured_ND_2 Injured        ND
11 Injured_ND_3 Injured        ND
12 Injured_ND_4 Injured        ND
13  Injured_D_1 Injured         D
14  Injured_D_2 Injured         D
15  Injured_D_3 Injured         D
16  Injured_D_4 Injured         D

D represents a special diet, and ND represents normal diet.

I want to compare the difference in gene expression between the Injured Group With Special Diet vs. Control Group with no diet (ND).

Running DESeq as follows:

dds$treatment = relevel( dds$treatment, "ND") #Setting references

dds$type=relevel(dds$type,"Control") #Setting references

design(dds)<- ~ type + treatment + type:treatment

res <- DESeq2(dds)

The result names of res are:





How would I use the results function to compare the Injured_D group vs. Control_ND group? I want to see the combined effect of having a special diet and being injured relative to the control group (injured) that has a normal diet. This is essentially comparing Samples #1-4 vs. Samples #13-16

Thank you so much!!!

designmatrix deseq2 DESeq2 • 498 views
Entering edit mode
swbarnes2 ★ 1.1k
Last seen 8 hours ago
San Diego

There are ways to do that comparison with your design, but it's much simpler and easier to follow if you do it as described in the vignette

Entering edit mode

Thank you so much for your helpful reply. To make sure I understood it, we combine the treatment and type variable into one variable (let's call it group). Thus, we have the following meta data.

         sample  group
1  Control_ND_1 ControlND
2  Control_ND_2 ControlND
3  Control_ND_3 ControlND
4  Control_ND_4 ControlND
5   Control_D_1  ControlD
6   Control_D_2  ControlD
7   Control_D_3  ControlD
8   Control_D_4  ControlD
9  Injured_ND_1 InjuredND
10 Injured_ND_2 InjuredND
11 Injured_ND_3 InjuredND
12 Injured_ND_4 InjuredND
13  Injured_D_1  InjuredD
14  Injured_D_2  InjuredD
15  Injured_D_3  InjuredD
16  Injured_D_4  InjuredD

Then, we run the following:

    design(dds)<- ~ group

    res<- DESeq2(dds)

Then, to get the comparison we wanted (InjuredD vs. ControlND), we simply run:

  results(res, contrast=c("group", "InjuredD", "ControlND"))

Is the right approach? Your advice and help is truly appreciated.

Entering edit mode

That's just what the vignette shows.


Login before adding your answer.

Traffic: 234 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6