Entering edit mode
Jorge Miró
▴
160
@jorge-miro-5469
Last seen 10.3 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]]