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

Gordon K Smyth smyth at wehi.EDU.AU
Wed Aug 13 01:52:23 CEST 2014


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 at worc.ox.ac.uk>
> To: "bioconductor at r-project.org" <bioconductor at r-project.org>
> 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}}


More information about the Bioconductor mailing list