[BioC] edgeR factorial experiment contrasts
Jahn Davik
jahn.davik at bioforsk.no
Wed Sep 3 22:10:43 CEST 2014
Hi Jim,
Yes, I believe I can see that (except for possibly my third question). It's just that I tend to think along these lines. Are they wrong?
jahn
________________________________
Fra: James W. MacDonald [jmacdon at uw.edu]
Sendt: 3. september 2014 22:06
Til: Jahn Davik [guest]
Kopi: bioconductor at r-project.org; Jahn Davik
Emne: Re: [BioC] edgeR factorial experiment contrasts
Hi Jahn,
Things will go much easier for you if you just parameterize as cell means rather than a conventional factorial model.
grps <- factor(paste(Group, Time, sep = "_"))
design <- model.matrix (~0+grps)
Then all the comparisons are easy to do.
Best,
Jim
On Wed, Sep 3, 2014 at 12:39 PM, Jahn Davik [guest] <guest at bioconductor.org<mailto:guest at bioconductor.org>> wrote:
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<http://bioconductor.org>.
_______________________________________________
Bioconductor mailing list
Bioconductor at r-project.org<mailto:Bioconductor at r-project.org>
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
--
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099
[[alternative HTML version deleted]]
More information about the Bioconductor
mailing list