# [BioC] RE: limma package

Gordon Smyth smyth at wehi.edu.au
Sat Sep 13 17:58:27 MEST 2003

```At 03:43 PM 10/09/2003, Nolwenn Le Meur wrote:
>... we are using a commmon reference.
>... experiment is:
>
>Cy5Infarctus 5days/Cy3Reference (3 replicated slides)
>Cy5Infarctus 15days/Cy3Reference (3 replicated slides)
>Cy5Infarctus 30days/Cy3Reference (3 replicated slides)
>
>Cy5Infarctus+drug 5days/Cy3Reference (3 replicated slides)
>Cy5Infarctus+drug 15days/Cy3Reference (3 replicated slides)
>Cy5Infarctus+drug 30days/Cy3Reference (3 replicated slides)
>
>Cy5drug 5days/Cy3Reference (3 replicated slides)
>Cy5drug 15days/Cy3Reference (3 replicated slides)
>Cy5drug 30days/Cy3Reference (3 replicated slides)
>
>And we would like to see the time effect and the drug effect. Do you still
>recommand me to use your contrasts.fit() approach?

Here is one possible approach for analysing your data with limma. The idea
is to fit a basic model with a coefficient for each treatment combination,
and then to extract information from the basic fit corresponding to any
comparisons you want to make. The same approach will work for Affymetrix
experiments.

Firstly, construct a design matrix with a column for each treatment
combination, for example

treatments <- c("I5","I15","I30","ID5","ID15","ID30","D5","D15","D30")
targets <- factor(rep(1:9,each=3))
design <- model.matrix(~ targets-1)
colnames(design) <- treatments

The use of colnames is important, as we'll see. Now obtain the basic model fit:

fit <- lmFit(RG, design)

Now you can ask any questions you want. For example, which genes respond to
the drug at the 30 day mark, i.e., which gene are differentially expressed
between infarctus+drug 30days and infarctus 30 days?

cont.matrix <- makeContrasts(ID30-I30, levels=design)
fit1 <- contrasts.fit(fit, cont.matrix)
fit1 <- eBayes(fit1)
topTable(fit1)

Which genes show any changes over time in response to infarctus and drug?

cont.matrix <- makeContrasts(ID15-ID5, ID30-ID15, levels=design)
fit2 <- contrasts.fit(fit, cont.matrix)
fit2 <- eBayes(fit2)
clas <- classifyTests(fit2)

Any gene with any non-zero entry in the matrix 'clas' is non-constant over
the three times.

You can put as many comparisons as you like into the contrast matrix.

Gordon

>  Do you have another idea
>? I have started to look through R and Bioconductor package for microarray
>analysis but new powerfull function are quick to be added and I miss some.
>
>Nolwenn Le Meur

```