[BioC] Time course....makeConstrasts()

James W. MacDonald jmacdon at med.umich.edu
Tue Mar 14 23:13:37 CET 2006


Khan, Sohail wrote:
> Thanks Sean.
> 
> My code and the sessionInfo:
> Thanks Sean.
> 
> Here is my code and sessionInfo.
> 
> targets
>    FileName Target
> 1 DF_02.CEL    0hr
> 2 DF_04.CEL    2hr
> 3 DF_05.CEL    2hr
> 4 DF_07.CEL    4hr
> 5 DF_08.CEL    4hr
> 
>>lev <- c("0hr","2hr","4hr")
>>lev
> 
> [1] "0hr" "2hr" "4hr"
> 
>>f <- factor(targets$Target, levels=lev)
>>f
> 
> [1] 0hr 2hr 2hr 4hr 4hr
> Levels: 0hr 2hr 4hr
> 
>>design <- model.matrix(~0+f)
>>colnames(design) <- lev
>>design
> 
>   0hr 2hr 4hr
> 1   1   0   0
> 2   0   1   0
> 3   0   1   0
> 4   0   0   1
> 5   0   0   1
> attr(,"assign")
> [1] 1 1 1
> attr(,"contrasts")
> attr(,"contrasts")$f
> [1] "contr.treatment"
> 
> 
>>fit <- lmFit(eset, design)
>>cont.wt <- makeContrasts(
> 
> + "2hr-0hr",
> + "4hr-2hr",
> + levels=design)

The problem is here - you cannot have your contrasts start with numbers 
or you will have a parse error. Either rename your design matrix columns 
to something like Hr0, Hr2, etc and use makeContrasts(Hr2 - Hr0, Hr4 - 
Hr2, levels=design) or build your contrasts matrix by hand

cont.wt <- matrix(c(-1,1,0,0,-1,1), nr=3, nc=2, 
dimnames=list(colnames(design), paste(c("2hr", "4hr"), c("0hr","2hr"), 
sep= " - ")))

HTH,

Jim


> Error in parse(file, n, text, prompt) : parse error
> 
> 
>>sessionInfo()
> 
> R version 2.1.1, 2005-06-20, i386-pc-mingw32 
> 
> attached base packages:
> [1] "splines"   "tools"     "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"  "base"     
> 
> other attached packages:
> hgu133a2probe   hgu133a2cdf         limma      affydata       affyPLM         gcrma   matchprobes          affy    reposTools       Biobase 
>      "1.10.0"      "1.10.0"       "2.0.8"       "1.4.1"       "1.3.3"       "1.1.4"      "1.0.22"       "1.6.7"      "1.5.19"      "1.5.12" 
> 
> 
> -Sohail
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor


-- 
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623



More information about the Bioconductor mailing list