How do I set up a contrast matrix in edgeR with makeContrasts, when a relevant level was dropped?
1
0
Entering edit mode
Ryan • 0
@d1c03bfa
Last seen 3 months ago
United States

I have some RNASeq data from a microbe that was grown either aerobically or anaerobically, and samples were taken at T0, T1, T2, or T3.

To set up a model matrix describing my sample, I have done the following...

permut <- model.matrix(~ 0 + aerobicity + timing)


And this yields the following, dropping level T0, which makes sense.

   aerobic anaerobic T1 T2 T3
1        1         0  0  0  0
2        1         0  0  0  0
3        1         0  1  0  0
4        1         0  1  0  0
5        1         0  0  1  0
6        1         0  0  1  0
7        1         0  0  0  1
8        1         0  0  0  1
9        1         0  0  0  0
10       1         0  0  0  0
11       1         0  1  0  0
12       1         0  1  0  0
13       1         0  0  1  0
14       1         0  0  1  0
15       1         0  0  0  1
16       1         0  0  0  1
17       0         1  0  0  0
18       0         1  0  0  0
19       0         1  1  0  0
20       0         1  1  0  0
21       0         1  0  1  0
22       0         1  0  1  0
23       0         1  0  0  1
24       0         1  0  0  1
25       0         1  0  0  0
26       0         1  0  0  0
27       0         1  1  0  0
28       0         1  1  0  0
29       0         1  0  1  0
30       0         1  0  1  0
31       0         1  0  0  1
32       0         1  0  0  1


When I set up contrasts, I can easily compare the aerobic to anaerobic growth conditions:

aerobicity_contrast <- makeContrasts(aerobic - anaerobic, levels = permut)


But, I am sad to say that I am stumped trying to set up a contrast between T3 and T0. Since the level is dropped, I am not sure how to extract the relevant contrasts from the model. The following clearly doesn't work:

timing_contrast <- makeContrasts(T3 - T0, levels = permut)


However, dropping T0 from the makeContrasts works, but I am unsure if this is appropriate given the model.

timing_contrast <- makeContrasts(T3, levels = permut)


Any advice would be appreciated.

edgeR RNASeq • 176 views
ADD COMMENT
0
Entering edit mode

I'll leave this comment for the sake of posterity.

If anyone is curious, just making a contrast with T3 does work the same as T3 - T0. I made a convoluted model.matrix, leaving out one of the other time points, and called T3 - T0, and got the same answer to prove it to myself.

ADD REPLY
2
Entering edit mode
@gordon-smyth
Last seen 2 hours ago
WEHI, Melbourne, Australia

Your comment is correct, but there is actually no need for a contrast at all to test T3 vs T0. The T3 coefficient is already the T3 vs T0 contrast.

That's why glmQLFTest and glmLRT have a coef argument as well as a contrast argument. Just set coef="T3" to test the T3 vs T0 contrast.

ADD COMMENT

Login before adding your answer.

Traffic: 634 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6