limma design matrix and contrast specification for time course PCR data with two conditions and variable replicate number

Gordon K Smyth <[email protected]>
Newsgroups gmane.science.biology.informatics.conductor
Message-ID <[email protected]>
Dear Linus,

Yes, the problem is the colon in the column names (not a semi-colon).  The 
error message says to see help(make.names), which says

"A syntactically valid name consists of letters, numbers and the dot or 
underline characters and starts with a letter or the dot not followed by a 
number."

You might find it informative to try see what make.names(colnames(design)) 
does.

Anyway, to form your contrast you could use:

cont.VEGF <-
   makeContrasts(contrasts="cond0.timePoints-cond1.timePoints",
   levels=make.names(colnames(design)))

or just make it yourself by

cont.VEGF <- c(0,0,-1,1)

Best wishes
Gordon

> Date: Tue, 12 Aug 2014 00:38:14 +0000
> From: Linus Schumacher <linus.schumacher-/[email protected]>
> To: "[email protected]" <[email protected]>
> Subject: [BioC] limma design matrix and contrast specification for
> 	time course PCR data with two conditions and variable replicate number
>
> Dear list,
>
> I’m trying to find differential expression between two conditions, as 
> well as within a condition over time. The data are RTqPCR, log10 
> relative expression of 96 genes (by 55), under 2 conditions, at 8 
> unevenly spaced timepoints with some missing data (NA) and variable 
> number of replicates (2-3):
>
> nReplicates <- c(3,3,3,3,3,3,2,3, 2,3,2,3,2,2,3,3)
> replicates <- rep(c(1:16), nReplicates)
> timePoints <- rep(rep(c(2,4,8,16,30,45,60,90),2), nReplicates)
> cond <- factor(rep(rep(0:1, each=8), nReplicates))
>
> I’ve managed to run the analysis, but I’m unfamiliar with the syntax for 
> specifying the design matrix and would greatly appreciate if someone 
> could confirm the design matrix is set up correctly. I couldn’t find an 
> intuitive explanation, so I have been working of examples from related 
> cases.
>
> design <- model.matrix(~cond+timePoints:cond)
>   (Intercept) cond1 cond0:timePoints cond1:timePoints
> 1            1     0                2                0
> 2            1     0                2                0
> ...
> 23           1     0               90                0
> 24           1     1                0                2
> ...
> 43           1     1                0               90
> attr(,"assign")
> [1] 0 1 2 2
> attr(,"contrasts")
> attr(,"contrasts")$cond
> [1] "contr.treatment"
>
> Now to determine which gene are differentially expressed between the two conditions,
>
> dupfit <- duplicateCorrelation(data,design,block=replicates)
> fit <- lmFit(data,design,block=replicates,correlation=dupfit$consensus)
> fit <- eBayes(fit)
> topTable(fit,coef="cond1")
>
> (I have checked dupfit$consensus and is positive, if small (0.11))
>
> And to determine difference in slope of genes under two conditions, I tried
>
> cont.VEGF <- makeContrasts(contrasts="cond0:timePoints-cond1:timePoints",levels=design)
> fit2 <- contrasts.fit(fit, cont.VEGF)
> fit2 <- ebayes(fit2)
> topTable(fit2)
>
> but I seem to have the wrong contrast specification, as I got the following error:
>
> Error in makeContrasts(contrasts = "cond0:timePoints-cond1:timePoints",  :
>  The levels must by syntactically valid names in R, see help(make.names).  Non-valid names: cond0:timePoints,cond1:timePoints
>
> Is it the semi-colon? If so, how do I change this in the design matrix 
> specification (where the semicolon comes from), while still getting the 
> same model fitting?
>
> Apologies if this question is already answered elsewhere, I could only 
> find parts of it in the list archives and the documentation.
>
> With kind regards,
>
> Linus Schumacher

______________________________________________________________________
The information in this email is confidential and intend...{{dropped:5}}

_______________________________________________
Bioconductor mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.