DESeq2 design with multiple factors
Entering edit mode
Vanilla • 0
Last seen 3.3 years ago
Hong Kong

Hi everyone,

I have a few samples with the following coldata:

  samples    condition    library    time    pos_neg

1 A_1_pos    A_1_pos    A    1    pos

2 A_1_neg    A_1_neg    A    1    neg

3 A_2_pos    A_2_pos    A    2    pos

4 A_2_neg    A_2_neg    A    2    neg

5 A_3_pos    A_3_pos    A    3    pos

6 A_3_neg    A_3_neg    A    3    neg

7 B_4_pos    B_4_pos    B    4    pos

8 C_1_pos1    C_1_pos    C    1    pos

9 C_1_pos2    C_1_pos    C    1    pos

10 C_1_pos3    C_1_pos    C    1    pos

11 C_1_neg1    C_1_neg   C    1    neg

12 C_1_neg2    C_1_neg    C    1    neg

13 C_2_pos1    C_2_pos   C    2   pos

14 C_2_pos2    C_2_pos    C    2    pos

15 C_2_pos3    C_2_pos    C    2    pos

16 C_2_neg1    C_2_neg    C    2    neg

17 C_2_neg2    C_2_neg    C    2    neg

18 C_3_pos1    C_3_pos    C    3    pos

19 C_3_pos2    C_3_pos    C    3    pos

20 C_3_pos3    C_3_pos    C    3    pos

21 C_3_pos4    C_3_pos    C    3    pos

22 C_3_neg1    C_3_neg    C    3    neg

23 C_3_neg2     C_3_neg    C    3    neg

24 C_3_neg3    C_3_neg    C    3    neg

25 C_3_neg4    C_3_neg    C    3    neg

A simple clustering showed the samples can be well clustered by "time", and among samples with the same "time", they were further well clustered by "library", but not clearly clustered by "pos_neg".


Now my purpose is to find:

1. DEGs of "pos" samples between each two adjacent "time", i.e, 1_pos VS 2_pos, 2_pos VS 3_pos, 3_pos VS 4_pos (though there's only one sample without replicate), no matter what "library" it is.

2. DEGs between "pos" and "neg", no matter "library" and "time". (Is there a difference to find DEGs between "pos" and "neg" in all "time", and that in any "time"?)

So how could I make the design and contrast matrix to achieve my purposes? 

Thanks for any kind of comments and suggestions.

rnaseq deseq2 multiple factor design • 539 views
Entering edit mode
Last seen 1 hour ago
United States

You can create a factor that combines time and condition (pos/neg). Let's call this new factor 'group'.

Then you can use a design of ~library + group.

You can contrast the levels of group easily using

results(dds, contrast=c("group","1_pos","2_pos"))

and so on.

If you want to average over time points you can use a list-style contrast:

results(dds, contrasts=list(c("1_pos","2_pos"), c("1_neg","2_neg")), listValues=c(1/2, -1/2))

The listValues are what the first and second elements of the list get multiplied by. By putting 1/2 there it is averaging the pos vs neg effect across time.

Entering edit mode

Thanks, Michael! That's really great.

For the listValues, if I understand correctly, I should put c(1/4, -1/3) for averaging if my contrasts=list(c("1_pos", "2_pos", "3_pos", "4_pos"), c("1_neg", "2_neg", "3_neg")) right?

Entering edit mode

Yes, that will average over those levels.

Entering edit mode

Got it. Thanks!


Login before adding your answer.

Traffic: 189 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