[BioC] Limma; matrix of microarray data and design matrix

James W. MacDonald jmacdon at med.umich.edu
Fri Jun 3 15:46:24 CEST 2011

Hi John,

On 6/3/2011 9:20 AM, john herbert wrote:
> Dear Bioconductors.
> I have a six column matrix of one colour array data (first 3 columns are
> case, second 3 are control), quantile normalized.
> I would like to do simple differential gene expression using limma.
> Is there a line or two of code that generates a simple design matrix for
> this scenario?
> I usually use a design matrix created from a targets file, and I never
> really understand lines like...  design<- model.matrix(~0+f) (what is
> ~0+f)?

No idea what f is here (other than the obvious; it is a variable 
pointing to a set of factors).

But constructing the design matrix is simple.

f <- factor(rep(c("case","control"), each = 3)) # ;-D
design <- model.matrix(~f)
fit <- lmFit(<yourmatrix>, design)
fit2 <- eBayes(fit)
topTable(fit2, coef=2)


design <- model.matrix(~0+f)
fit <- lmFit(<yourmatrix>, design)
fit2 <- contrasts.fit(fit, c(-1,1))
fit2 <- eBayes(fit2)
topTable(fit2, coef=1)

These results will be identical, except the signs will be flipped for 
your coefficients (and I would normally prefer the sign in the second 
case). It is worth your while to figure out why, and what the difference 
is between the two design matrices.



> 	[[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.
Douglas Lab
University of Michigan
Department of Human Genetics
5912 Buhl
1241 E. Catherine St.
Ann Arbor MI 48109-5618
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues 

More information about the Bioconductor mailing list