[BioC] edgeR factorial experiment contrasts

Jahn Davik [guest] guest at bioconductor.org
Wed Sep 3 18:39:12 CEST 2014


Hi,
I am trying to figure out how to do comparisons using edgeR but have to admit that I am on unsure ice.
My experiment is abiotic stress on two genotypes (E and J) and these have been sampled for RNA-seq at five time points (00, 01, 05, 48, and 96).
I would like to analyze this experiment as a factorial (which I am sure could be argued), and when I set up the following design:

> design<-model.matrix(~0 + Group + Time + Group*Time),

I get the following design matrix (I've taken out the 3 three replicates at experimental cell.):

> design
      GroupE GroupJ Time01 Time05 Time48 Time96 GroupJ:Time01 GroupJ:Time05 GroupJ:Time48 GroupJ:Time96
E00      1      0      0      0      0      0             0             0             0             0
J00      0      1      0      0      0      0             0             0             0             0
E01      1      0      1      0      0      0             0             0             0             0
J01      0      1      1      0      0      0             1             0             0             0
E05      1      0      0      1      0      0             0             0             0             0
J05      0      1      0      1      0      0             0             1             0             0
E48      1      0      0      0      1      0             0             0             0             0
J48      0      1      0      0      1      0             0             0             1             0
E96      1      0      0      0      0      1             0             0             0             0
J96      0      1      0      0      0      1             0             0             0             1
attr(,"assign")
 [1] 1 1 2 2 2 2 3 3 3 3
attr(,"contrasts")
attr(,"contrasts")$Group
[1] "contr.treatment"

attr(,"contrasts")$Time
[1] "contr.treatment"


I have some questions regarding testing contrasts:
First though, I realize that I can pull out the data for E00 and J00, say, and compare these using exactTest, but then I guess that you are disregarding all information that lies in the remaining data set? That does not seem to me to be a good way to do it. But I may be wrong here?

Second, if I want to do the comparison E00 vs J00 using the design indicated above, how should that be set up? Would

lrt <- glmLRT(fit,contrast=c(1,-1,0,0,0,0,0,0,0,0)) do it? 

Third, if I want to compare (E00 + E01 + E05) vs (E48 + E96), how would I set up that contrast?
For my own pedagogic reasons I can show how I was thinking in this case:

E00 = L1
E01 = L1 + L4   x 2  -->  6L1 + 2L3 + 2L4 
E05 = L1 + L4

versus                                       --> 2L3 + 2L4 - 3L5 -3L6

E48 = L1 + L5   x 3  -->  6L1 + 3L5 + 3L6
E96 = L1 + L6


resulting in the contrast:

lrt <- glmLRT(fit,contrast=c(0,0,2,2,-3,-3,0,0,0,0))

Then I seem to remember that contrasts should sum up to zero? If anybody could tell me where I am loosing it, I would be very obliged.

Thank you

jd





 -- output of sessionInfo(): 

R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Norwegian (Bokmål)_Norway.1252  LC_CTYPE=Norwegian (Bokmål)_Norway.1252   
[3] LC_MONETARY=Norwegian (Bokmål)_Norway.1252 LC_NUMERIC=C                              
[5] LC_TIME=Norwegian (Bokmål)_Norway.1252    

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] edgeR_3.6.8          limma_3.20.9         BiocInstaller_1.14.2

loaded via a namespace (and not attached):
[1] tools_3.1.0
> 

--
Sent via the guest posting facility at bioconductor.org.



More information about the Bioconductor mailing list