[BioC] limma contrast matrices

Dejian Zhao zhaodj at ioz.ac.cn
Fri Apr 25 11:16:55 CEST 2008


Thank you for your reply,Nick. I tried your suggestion but it does
not work.I received an error message when running the command
> contrast.matrix<-makeContrasts("WS-WU"=WS-WU,"MS-MU"=MS-MU,"(MS-MU)-(WS-WU)"=(MS-MU)-(WS-WU),levels=design)
Error in eval(expr, envir, enclos) : object "WU" not found

I think that is because I choose WU as a reference
> design<-modelMatrix(targets,ref="WU")
therefore in my design matrix there is no WU any more.
> design
     MS MU WS
[1,]  0  0  1
[2,]  0  0 -1
[3,]  1 -1  0
[4,] -1  1  0
[5,] -1  0  1
[6,]  1  0 -1
[7,]  0 -1  0
[8,]  0  1  0
Furthermore, when constructing contrast matrix
>contrast.matrix<-makeContrasts("WS-WU"=WS,"MS-MU"=MS-MU,"(MS-MU)-(WS-WU)"=(MS-MU)-WS,levels=design)
we have no WU to be used any more.

The way I constructed the contrast matrix may seem peculiar.
But I think it is feasible. Take for example the case in section 7.4
in limma user's guide.
In section 7.4, the author take CD4 as ref.
> design<-modelMatrix(targets,ref="CD4")
When constructing the contrast matrix, the authors use the command
> contrast.matrix<-cbind("CD8-CD4"=c(1,0),"DN-CD4"=c(0,1),"CD8-DN"=c(1,-1))
contrast.matrix
      Contrasts
Levels CD8-CD4 DN-CD4 CD8-DN
   CD8       1      0      1
   DN        0      1     -1

I think it hard for a biologist to do it in the above-mentioned way.
Instead, I tried the makeContrasts function
> contrast.matrix<-makeContrasts("CD8-CD4"=CD8,"DN-CD4"=DN,"CD8-DN"=CD8-DN,levels=design)
contrast.matrix
      Contrasts
Levels CD8-CD4 DN-CD4 CD8-DN
   CD8       1      0      1
   DN        0      1     -1

I get the SAME contrast matrix! It is much easier for a biologist to
achieve it.

That is how my peculiar way to construct matrix comes. I am
uncertain whether it is still valid in the factorial design. I
resort to this list to ascertain the result.

In section 8.7 the authors assume the arrays are single-color ones
for simplicity. However, WHAT IF they are two-color ones?
I got a result and hope experts in mathematics look into it, and
correct it if something goes wrong.

Thanks!

On Fri, Apr 25, 2008 15:20, Nick Henriquez wrote:
> No idea whether your chips were OK or properly normalised but
> assuming that
> is the case you're doing fine up to
>
> contrast.matrix<-makeContrasts("WS-WU"=WS,"MS-MU"=MS-MU,"(MS-MU)-(WS-WU)"=(M
S-MU)-WS,levels=design)
>
> where "WS-WU"=WS should probably be "WS-WU"=WS-WU otherwise why
> bother doing
> WU in the first place.
> Likewise then at the end it should read (MS-MU)-(WS-WU) if I
> understand the
> intentions correctly.
>
> Just in case: -1 indicates WS<WU and 1 indicates WS>WU (in this
> example)
>
> Happy analysing,
>
> Nick
>
> -----Original Message-----
> From: bioconductor-bounces at stat.math.ethz.ch
> [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of
Dejian Zhao
> Sent: 25 April 2008 05:47
> To: Bioconductor at stat.math.ethz.ch
> Subject: [BioC] limma contrast matrices
> Importance: High
>
> Dear all,
>
> I wrote this email to know whether my contrast matrices are
> conrrect. Many thanks in advance for any advice.
>
> I have a difficulty in constructing the contrast matrix of
factorial design in limma. In section 8.7 of limma user's guide, a
factorial design is discussed. My experimental design resembles
the example very much except that my arrays are direct two-color
arrays.
> Therefore the hybridization diagram is a square as follows:
>
> WS-MS
> |..|
> WU-MU
>
> W: wild type
> M: mutant
> U: unstimulated
> S: stimulated
> (The horizontal and vertical lines stand for direct
hybridizations, and the dots in the square have no meanings but to
fill the space)
>
> What I'm interested in are exactly the same as those in the
example. 1. Which genes respond to stimulation in wild type,
> 2. Which genes respond to stimulation in mutants,and
> 3. Which genes respond differently in mutants compared to wild type.
>
> I constructed the contrast matrices (see below in the code and
> results) without knowing their validity.
> Are they right?
>
>
>
> Part of my code and results are as follows:
>> sessionInfo()
> R version 2.6.2 (2008-02-08)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=Chinese_People's Republic of
> China.936;LC_CTYPE=Chinese_People's Republic of
> China.936;LC_MONETARY=Chinese_People's Republic of
> China.936;LC_NUMERIC=C;LC_TIME=Chinese_People's Republic of
> China.936
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] statmod_1.3.5 limma_2.12.0
>> targets
>   Cy5 Cy3 FileName
> 1  WS  WU    1.gpr
> 2  WU  WS    2.gpr
> 3  MS  MU    3.gpr
> 4  MU  MS    4.gpr
> 5  WS  MS    5.gpr
> 6  MS  WS    6.gpr
> 7  WU  MU    7.gpr
> 8  MU  WU    8.gpr
>> design<-modelMatrix(targets,ref="WU")
> Found unique target names:
>  MS MU WS WU
>> design
>      MS MU WS
> [1,]  0  0  1
> [2,]  0  0 -1
> [3,]  1 -1  0
> [4,] -1  1  0
> [5,] -1  0  1
> [6,]  1  0 -1
> [7,]  0 -1  0
> [8,]  0  1  0
>>
> contrast.matrix<-makeContrasts("WS-WU"=WS,"MS-MU"=MS-MU,"(MS-MU)-(WS-WU)"=(M
S-MU)-WS,levels=design)
>> contrast.matrix
>       Contrasts
> Levels WS-WU MS-MU (MS-MU)-(WS-WU)
>     MS     0     1               1
>     MU     0    -1              -1
>     WS     1     0              -1
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>



More information about the Bioconductor mailing list