[BioC] limma complex contrast matrix

Prasad Siddavatam siddavatam at gmail.com
Tue Mar 22 19:53:18 CET 2011


Dear Mailing list,

I Have couple of questions about contrast matrix

I have 206 arrays and here are the sample targets looks like
num  sample    age  gender strain stage       dis(time)
---  -------   ---  ------ ------ ------      -----
1   GSM614020  12    Male  DENV1   ucd          fu
2   GSM614021   7    Male  DENV1   ucd       acute
4   GSM614023  12    Male  DENV1   dss          fu
5   GSM614024  11    Male  DENV1   ucd         dis
6   GSM614025   5    Male  DENV1   dss          01
7   GSM614026   5    Male  DENV1   dss          fu
8   GSM614027  11    Male  DENV2   ucd       acute
9   GSM614028   4    Male  DENV1   ucd         dis
10  GSM614029  10  Female  DENV1   dss       acute
11  GSM614030  10  Female  DENV1   dss          01
12  GSM614031  10  Female  DENV1   dss         dis
13  GSM614032  10  Female  DENV1   dss          fu
15  GSM614034  14    Male  DENV1   dss          fu
16  GSM614035  10  Female  DENV1   dss         dis
17  GSM614036  10  Female  DENV1   dss          01
18  GSM614037  29  Female  DENV1   dss       acute
19  GSM614038  29  Female  DENV1   dss          01
20  GSM614039  29  Female  DENV1   dss         dis
21  GSM614040  14    Male  DENV1   dss       acute
61  GSM614080  11    Male  DENV2   dss       acute
62  GSM614081  11    Male  DENV2   dss         dis
63  GSM614082  19    Male  DENV1   dss       acute

This gives me 2 strain factors, 2 stage factors and 4 dis(time) factors. 
Among four time factors every time point is to be compared with "fu" time 
because this sample is taken in the follow up visit after recovery. (16 
comparisons)

I want to have DE genes from many contrasts
1. Expressed in DENV1 only and DEN2 only
2. Expressed in DENV1 with ucd and DEN1 with dss (Same for DEN2)
3. Expressed in DENV1 with ucd and acute (and for other times also)
4. Expressed in  and so on......

TS <- paste(target$strain, target$stage, target$dis, sep = ".");
TS <- factor(TS, levels = unique(TS));
design <- model.matrix(~0+TS);
colnames(design) <- levels(TS);

Here are the unique(TS) values  are.........
DENV1.ucd.fu    DENV1.ucd.acute DENV1.ucd.dis   DENV1.dss.fu 
DENV1.dss.01    DENV2.ucd.acute DENV1.dss.acute DENV1.dss.dis   
DENV2.ucd.fu   DENV2.dss.acute DENV2.dss.fu    DENV1.ucd.01    
DENV2.ucd.01   DENV2.dss.dis  DENV2.ucd.dis 

 
Here is my confusing "makeContrasts" function
contrast <- makeContrasts(d1.dss.dis = "DENV1.dss.dis - DENV1.dss.fu", 
d1.dss.acute = "DENV1.dss.acute - DENV1.dss.fu",
d1.dss.01 = "DENV1.dss.01 - DENV1.dss.fu",
d1.ucd.dis = "DENV1.ucd.dis - DENV1.ucd.fu",
d1.ucd.acute = "DENV1.ucd.acute - DENV1.ucd.fu",
d1.ucd.01 = "DENV1.ucd.01 - DENV1.ucd.fu",
d1.dssVSucd = "((DENV1.dss.acute + DENV1.dss.dis + DENV1.dss.01)/3 - 
(DENV1.dss.fu)) - ((DENV1.ucd.acute + DENV1.ucd.dis + DENV1.ucd.01)/3 - 
(DENV1.ucd.fu))",
d2.dss.dis = "DENV2.dss.dis - DENV2.dss.fu",
d2.dss.acute = "DENV2.dss.acute - DENV2.dss.fu",
d2.ucd.dis = "DENV2.ucd.dis - DENV2.ucd.fu",
d2.ucd.acute = "DENV2.ucd.acute - DENV2.ucd.fu",
d2.ucd.01 = "DENV2.ucd.01 - DENV2.ucd.fu",
d2.dssVSucd = "((DENV2.dss.acute + DENV2.dss.dis)/2 - (DENV2.dss.fu)) -  
((DENV2.ucd.acute + DENV2.ucd.dis + DENV2.ucd.01)/3 - (DENV2.ucd.fu))", 
d1VSd2 = "(((DENV1.dss.acute + DENV1.dss.dis + DENV1.dss.01)/3 - 
(DENV1.dss.fu)) 
+ ((DENV1.ucd.acute + DENV1.ucd.dis + DENV1.ucd.01)/3 - (DENV1.ucd.fu))) - 
((DENV2.dss.acute + DENV2.dss.dis)/2 - (DENV2.dss.fu)) +  ((DENV2.ucd.acute + 
DENV2.ucd.dis + DENV2.ucd.01)/3 - (DENV2.ucd.fu)))",       
levels = design);

here is the actual contrasts matrix I got (columns 4 to 7 are pasted)

Levels             d1.ucd.dis  d1.ucd.acute  d1.ucd.01  d1.dssVSucd
  DENV1.ucd.fu            -1           -1       -1       1.0000000
  DENV1.ucd.acute          0            1        0       -0.3333333
  DENV1.ucd.dis            1            0        0       -0.3333333
  DENV1.dss.fu             0            0        0       -1.0000000
  DENV1.dss.01             0            0        0       0.3333333
  DENV2.ucd.acute          0            0        0       0.0000000
  DENV1.dss.acute          0            0        0       0.3333333
  DENV1.dss.dis            0            0        0       0.3333333
  DENV2.ucd.fu             0            0        0       0.0000000
  DENV2.dss.acute          0            0        0       0.0000000
  DENV2.dss.fu             0            0        0       0.0000000
  DENV1.ucd.01             0            0        1       -0.3333333
  DENV2.ucd.01             0            0        0       0.0000000
  DENV2.dss.dis            0            0        0       0.0000000
  DENV2.ucd.dis            0            0        0       0.0000000

Please advise me whether I am doing it correct or not? Any help is highly 
appreciated

Above all, I want to add "age" and "gender" factors also later. I can't even 
imagine how messy the contrast would become. Technically (statistically) can I 
add those?

Thank you very much
Prasad



More information about the Bioconductor mailing list