[BioC] Help with contrast matrix

john seers (IFR) john.seers at bbsrc.ac.uk
Thu Jul 2 17:38:24 CEST 2009


Hi Jenny


>3 Does the number of coef correspond to the order of the contrasts listed in the contrast.matrix command? for example, coef=3 >corresponds to the contrast "wt5hr-ste5hr"?

That is correct.

Which means "wt5hr-wt4hr" is not your first contrast.

>Resultfile <- topTable(fit2, coef=1,n=8000,adjust="fdr") (for the first contrast "wt5hr-wt4hr"?)

I suggest you give your contrasts names. Then it is less easy to get them wrong. Use more meaningful names, but for example:

contrast.matrix <- makeContrasts(my1stcontrast=wt5hr, my2ndcontrast=ste4hr, 
	my3rdcontrast=wt5hr-ste5hr, my4thcontrast=ste5hr-ste4hr, levels=design)

Then you can say:

Resultfile <- topTable(fit2, coef=my3rdcontrast,n=8000,adjust="fdr") 

With less likelihood of getting the wrong coefficient.

>1. Have I done anything wrong so far?

Probably.

2. How can I print out a Toptable with gene lists for each contrast?

Produce a toptable for each coefficient and type in the name. e.g. just type in Resultfile. 
Sorry if this is not what you are asking.


Regards


John




-----Original Message-----
From: bioconductor-bounces at stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of Jenny Huang
Sent: 02 July 2009 15:48
To: bioconductor at stat.math.ethz.ch
Subject: [BioC] Help with contrast matrix






Dear all,
 
I have been reading the previous posts regarding design and contrast matrix, but I am still very confused. I would really appreciate your help as I really need to get my data analysis done ASAP.
 

I have a time course study with six differernt time points and two different genotypes. It was a loop design with dye swap. Here I will only use a four sample smaller loop design for an example:      SlideNumber   Name   FileName    Cy3    Cy5
s45       13790892    s45      File1     ste4hr ste5hr
s4w4      13790638   s4w4   File2     ste4hr  wt4hr
s54       13790634    s54      File3     ste5hr ste4hr
s5w5      13790635   s5w5   File4     ste5hr  wt5hr
w45       13769145    w45    File5     wt4hr  wt5hr
w4s4.1    13790637 w4s4.1 File6     wt4hr ste4hr
w4s4.2    13790877 w4s4.2 File7     wt4hr ste4hr
w54       13790631    w54    File8     wt5hr  wt4hr
w5s5      13790636   w5s5   File9     wt5hr ste5hr

 
I used:
> design <- modelMatrix(targets, ref="wt4hr")  design
       ste4hr ste5hr wt5hr
s45        -1      1     0
s4w4       -1      0     0
s54         1     -1     0
s5w5        0     -1     1
w45         0      0     1
w4s4.1      1      0     0
w4s4.2      1      0     0
w54         0      0    -1
w5s5        0      1    -1

> fit <- lmFit(MA, design)
> contrast.matrix <- makeContrasts(wt5hr, ste4hr, 
> wt5hr-ste5hr,ste5hr-ste4hr, levels=design)

> fit2 <- contrasts.fit(fit, contrast.matrix)
> fit2 <- eBayes(fit2)
> results <- decideTests(fit2)
 
My questions:
 
1. Have I done anything wrong so far?
2. How can I print out a Toptable with gene lists for each contrast?
I used the following command, but I think something was wrong because the genes that were identified differentially expressed do not seem to match genepix images at all:
 
Resultfile <- topTable(fit2, coef=1,n=8000,adjust="fdr") (for the first contrast "wt5hr-wt4hr"?)
> write.table(Resultfile,"w5w4_8000.txt",sep="\t")
 
3 Does the number of coef correspond to the order of the contrasts listed in the contrast.matrix command? for example, coef=3 corresponds to the contrast "wt5hr-ste5hr"?
 
I am very sorry for the long questions. I am totally not sure about this contrast matrix thing, and THANK YOU SO MUCH for your help.
 
 
Thanks
 
-Jenny



      
	[[alternative HTML version deleted]]



More information about the Bioconductor mailing list