design and contrat matrix in limma for Affymetrix arrays
1
0
Entering edit mode
Jorge Miró ▴ 160
@jorge-miro-5469
Last seen 9.6 years ago
Hi, I am trying to understand how to make the design matrix and the contrat matrix for my analysis of gene expressions but I really can't figure it out. What I have is 9 arrays where three of them correspond to untreated individuals (groupA), another three correpond to a low level of treatment (groupB) and the last three to a higher level of treatment (groupC). What I want to do is to compare the treatments and check what genes have been affected in some kind of loop design, i.e groupA compared with groupB, groupA compared with groupC and groupB compared with groupC. I have read in the limma user guide and think a design matrix like the one below could do what I want but I'm really not sure if I'm doing something wrong: #COntruct design matrix > design <- model.matrix(~ 0+factor(c(1,1,1,2,2,2,3,3,3))) > colnames(design) <- c('GroupA', 'GroupB', 'GroupC') #Contruct contrast matrix > contrast.matrix <- makeContrasts(GroupB-GroupA, GroupC-GroupA, GroupC-GroupB, levels=design) #Print design matrix > design GroupA GroupB GroupC 1 1 0 0 2 1 0 0 3 1 0 0 4 0 1 0 5 0 1 0 6 0 1 0 7 0 0 1 8 0 0 1 9 0 0 1 attr(,"assign") [1] 1 1 1 attr(,"contrasts") attr(,"contrasts")$`factor(c(1, 1, 1, 2, 2, 2, 3, 3, 3))` [1] "contr.treatment" #Print contrast matrix > contrast.matrix Contrasts Levels GroupB - GroupA GroupC - GroupA GroupC - GroupB GroupA -1 -1 0 GroupB 1 0 -1 GroupC 0 1 1 #Session info > sessionInfo() R version 2.15.0 (2012-03-30) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=Swedish_Sweden.1252 LC_CTYPE=Swedish_Sweden.1252 LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C LC_TIME=Swedish_Sweden.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] limma_3.12.1 Biobase_2.16.0 BiocGenerics_0.2.0 loaded via a namespace (and not attached): [1] affylmGUI_1.30.0 IRanges_1.14.4 oneChannelGUI_1.22.10 stats4_2.15.0 tcltk_2.15.0 > [[alternative HTML version deleted]]
limma limma • 1.0k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 2 hours ago
United States
Hi Jorge, On 8/28/2012 10:34 AM, Jorge Mir? wrote: > Hi, > > I am trying to understand how to make the design matrix and the contrat > matrix for my analysis of gene expressions but I really can't figure it out. > What I have is 9 arrays where three of them correspond to untreated > individuals (groupA), another three correpond to a low level of treatment > (groupB) and the last three to a higher level of treatment (groupC). What I > want to do is to compare the treatments and check what genes have been > affected in some kind of loop design, i.e groupA compared with > groupB, groupA compared with groupC and groupB compared with groupC. > I have read in the limma user guide and think a design matrix like the one > below could do what I want but I'm really not sure if I'm doing something > wrong: Looks good to me. Best, Jim > > #COntruct design matrix >> design<- model.matrix(~ 0+factor(c(1,1,1,2,2,2,3,3,3))) >> colnames(design)<- c('GroupA', 'GroupB', 'GroupC') > #Contruct contrast matrix >> contrast.matrix<- makeContrasts(GroupB-GroupA, GroupC-GroupA, > GroupC-GroupB, levels=design) > > #Print design matrix >> design > GroupA GroupB GroupC > 1 1 0 0 > 2 1 0 0 > 3 1 0 0 > 4 0 1 0 > 5 0 1 0 > 6 0 1 0 > 7 0 0 1 > 8 0 0 1 > 9 0 0 1 > attr(,"assign") > [1] 1 1 1 > attr(,"contrasts") > attr(,"contrasts")$`factor(c(1, 1, 1, 2, 2, 2, 3, 3, 3))` > [1] "contr.treatment" > > #Print contrast matrix >> contrast.matrix > Contrasts > Levels GroupB - GroupA GroupC - GroupA GroupC - GroupB > GroupA -1 -1 0 > GroupB 1 0 -1 > GroupC 0 1 1 > > > #Session info >> sessionInfo() > R version 2.15.0 (2012-03-30) > Platform: i386-pc-mingw32/i386 (32-bit) > > locale: > [1] LC_COLLATE=Swedish_Sweden.1252 LC_CTYPE=Swedish_Sweden.1252 > LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C > LC_TIME=Swedish_Sweden.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] limma_3.12.1 Biobase_2.16.0 BiocGenerics_0.2.0 > > loaded via a namespace (and not attached): > [1] affylmGUI_1.30.0 IRanges_1.14.4 oneChannelGUI_1.22.10 > stats4_2.15.0 tcltk_2.15.0 > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > 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
ADD COMMENT
0
Entering edit mode
Hi James, thank you very much for taking a look at my question. Your answer will help a lot. Best regards Jorge On Tue, Aug 28, 2012 at 4:44 PM, James W. MacDonald <jmacdon@uw.edu> wrote: > Hi Jorge, > > > On 8/28/2012 10:34 AM, Jorge Miró wrote: > >> Hi, >> >> I am trying to understand how to make the design matrix and the contrat >> matrix for my analysis of gene expressions but I really can't figure it >> out. >> What I have is 9 arrays where three of them correspond to untreated >> individuals (groupA), another three correpond to a low level of treatment >> (groupB) and the last three to a higher level of treatment (groupC). What >> I >> want to do is to compare the treatments and check what genes have been >> affected in some kind of loop design, i.e groupA compared with >> groupB, groupA compared with groupC and groupB compared with groupC. >> I have read in the limma user guide and think a design matrix like the one >> below could do what I want but I'm really not sure if I'm doing something >> wrong: >> > > Looks good to me. > > Best, > > Jim > > > >> #COntruct design matrix >> >>> design<- model.matrix(~ 0+factor(c(1,1,1,2,2,2,3,3,3))**) >>> colnames(design)<- c('GroupA', 'GroupB', 'GroupC') >>> >> #Contruct contrast matrix >> >>> contrast.matrix<- makeContrasts(GroupB-GroupA, GroupC-GroupA, >>> >> GroupC-GroupB, levels=design) >> >> #Print design matrix >> >>> design >>> >> GroupA GroupB GroupC >> 1 1 0 0 >> 2 1 0 0 >> 3 1 0 0 >> 4 0 1 0 >> 5 0 1 0 >> 6 0 1 0 >> 7 0 0 1 >> 8 0 0 1 >> 9 0 0 1 >> attr(,"assign") >> [1] 1 1 1 >> attr(,"contrasts") >> attr(,"contrasts")$`factor(c(**1, 1, 1, 2, 2, 2, 3, 3, 3))` >> [1] "contr.treatment" >> >> #Print contrast matrix >> >>> contrast.matrix >>> >> Contrasts >> Levels GroupB - GroupA GroupC - GroupA GroupC - GroupB >> GroupA -1 -1 0 >> GroupB 1 0 -1 >> GroupC 0 1 1 >> >> >> #Session info >> >>> sessionInfo() >>> >> R version 2.15.0 (2012-03-30) >> Platform: i386-pc-mingw32/i386 (32-bit) >> >> locale: >> [1] LC_COLLATE=Swedish_Sweden.1252 LC_CTYPE=Swedish_Sweden.1252 >> LC_MONETARY=Swedish_Sweden.**1252 LC_NUMERIC=C >> LC_TIME=Swedish_Sweden.1252 >> >> attached base packages: >> [1] stats graphics grDevices utils datasets methods base >> >> other attached packages: >> [1] limma_3.12.1 Biobase_2.16.0 BiocGenerics_0.2.0 >> >> loaded via a namespace (and not attached): >> [1] affylmGUI_1.30.0 IRanges_1.14.4 oneChannelGUI_1.22.10 >> stats4_2.15.0 tcltk_2.15.0 >> [[alternative HTML version deleted]] >> >> ______________________________**_________________ >> Bioconductor mailing list >> Bioconductor@r-project.org >> https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.e="" thz.ch="" mailman="" listinfo="" bioconductor=""> >> Search the archives: http://news.gmane.org/gmane.** >> science.biology.informatics.**conductor<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]]
ADD REPLY

Login before adding your answer.

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