I am having difficulty formulating my comparisons (cont.matrix script).  My statistician suggested using the factorial example and adapting it to my data.  I am using Windows XP and running current versions of R and Limma.

For each sample time I have 3 or 4 biological replicates.  I have 4 sample times (0, 24, 48 and 96 hours) for each fish species.  I have two fish species (s=sockeye and c=coho).  I'm not sure that my targets file is correct.  Here it is:

   FileName Species Time

1      c0M1      c1    0

2      c0M2      c2    0

3      c0M3      c3    0

4      c0M4      c4    0

5      s0M1      s1    0

6      s0M2      s2    0

7      s0M3      s3    0

8     c24M1      c1   24

9     c24M2      c2   24

10    c24M3      c3   24

11    s24M1      s1   24

12    s24M2      s2   24

13    s24M3      s3   24

14    s24M4      s4   24

15    c48M1      c1   48

16    c48M2      c2   48

17    c48M3      c3   48

18    s48M1      s1   48

19    s48M2      s2   48

20    s48M3      s3   48

21    s48M4      s4   48

22    c96M1      c1   96

23    c96M2      c2   96

24    c96M3      c3   96

25    s96M1      s1   96

26    s96M2      s2   96

27    s96M3      s3   96

28    s96M4      s4   96



Here is my script up to cont.matrix



# Set up character list defining your arrays, include replicates

TS <- paste(targets$Species, targets$Time, sep=".")

#This script returns the following:

TS

#[1] "c1.0"  "c2.0"  "c3.0"  "c4.0"  "s1.0"  "s2.0"  "s3.0"  "c1.24" "c2.24" "c3.24" "s1.24"

#[12] "s2.24" "s3.24" "s4.24" "c1.48" "c2.48" "c3.48" "s1.48" "s2.48" "s3.48" "s4.48" "c1.96"

#[23] "c2.96" "c3.96" "s1.96" "s2.96" "s3.96" "s4.96"

# Turn TS into a factor variable which facilitates fitting

TS <- factor(TS)

#This script returns the following

TS

#[1] c1.0  c2.0  c3.0  c4.0  s1.0  s2.0  s3.0  c1.24 c2.24 c3.24 s1.24 s2.24 s3.24 s4.24

#[15] c1.48 c2.48 c3.48 s1.48 s2.48 s3.48 s4.48 c1.96 c2.96 c3.96 s1.96 s2.96 s3.96 s4.96

#28 Levels: c1.0 c1.24 c1.48 c1.96 c2.0 c2.24 c2.48 c2.96 c3.0 c3.24 c3.48 c3.96 ... s4.96

#do this as is

design <- model.matrix(~0+TS)

#this script returns:(see Appendix 1, too long to include here)

colnames(design) <- levels(TS)

#for eset put in your M values - see ?lmFit for object types

fit <- lmFit(eset, design)



Here are my desired are my desired comparisons:



      Comparisons
      
      
      Sockeye Over Time
     Formula
     
      
      s0 versus s24
     s.0vss.24=((s1.0+s2.0+s3.0)/3)-((s1.24+s2.24+s3.24+s4.24)/4), 
     
      s24 versus s48
     s.24vss.48=s((s1.24+s2.24+s3.24+s4.24)/4)-((s1.48+s2.48+s3.48+s4.48)/4), 
     
      s48 versus s96
     s.48vss.96=((s1.48+s2.48+s3.48+s4.48)/4)-((s1.96+s2.96+s3.96+s4.96)/4), 
     
      s0 versus s48
     s.0vss.48=((s1.0+s2.0+s3.0)/3)-((s1.48+s2.48+s3.48+s4.48)/4), 
     
      s0 versus s96
     s.0vss.96=((s1.48+s2.48+s3.48+s4.48)/4)-((s1.96+s2.96+s3.96+s4.96)/4), 
     
      
      Coho Over Time
      
      
      c0 versus c24
     c.0vsc.24=((c1.0+c2.0+c3.0+c4.0)/4)-((c1.24+c2.24+c3.24)/3), 
     
      c24 versus c48
     c.24vsc.48=((c1.24+c2.24+c3.24)/3)-((c1.48+c2.48+c3.48)/3), 
     
      c48 versus c96
     c.48vsc.96=((c1.48+c2.48+c3.48)/3)-((c1.96+c2.96+c3.96)/3), 
     
      c0 versus c48
     c.0vsc.48=((c1.0+c2.0+c3.0+c4.0)/4)-((c1.48+c2.48+c3.48)/3),
     
      c0 versus c96
     c.0vsc.96=((c1.0+c2.0+c3.0+c4.0)/4)-((c1.96+c2.96+c3.96)/3),
     
      
      
      Coho vs Sockeye
      
      
      s0 versus c0
     s.0vsc.0=((s1.0+s2.0+s3.0)/3)-((c1.0+c2.0+c3.0+c4.0)/4), 
     
      s24 versus c24
     s.24vsc.24=((s1.24+s2.24+s3.24+s4.24)/4)-((c1.24+c2.24+c3.24)/3), 
     
      s48 versus c48
     s.48vsc.48=((s1.48+s2.48+s3.48+s4.48)/4)-((c1.48+c2.48+c3.48)/3), 
     
      s96 versus c96
     s.96vsc.96=((s1.96+s2.96+s3.96+s4.96)/4)-((c1.96+c2.96+c3.96)/3)
     



Here is my attempt at the cont.matrix, which I don't believe is correct:

cont.matrix <- makeContrasts(s.0vss.24=(((s1.0+s2.0+s3.0)/3)-((s1.24+s2.24+s3.24+s4.24)/4), s.24vss.48=s((s1.24+s2.24+s3.24+s4.24)/4)-((s1.48+s2.48+s3.48+s4.48)/4), s.48vss.96=((s1.48+s2.48+s3.48+s4.48)/4)-((s1.96+s2.96+s3.96+s4.96)/4), s.0vss.48=((s1.0+s2.0+s3.0)/3)-((s1.48+s2.48+s3.48+s4.48)/4), s.0vss.96=((s1.48+s2.48+s3.48+s4.48)/4)-((s1.96+s2.96+s3.96+s4.96)/4), c.0vsc.24=((c1.0+c2.0+c3.0+c4.0)/4)-((c1.24+c2.24+c3.24)/3), c.24vsc.48=((c1.24+c2.24+c3.24)/3)-((c1.48+c2.48+c3.48)/3), c.48vsc.96=((c1.48+c2.48+c3.48)/3)-((c1.96+c2.96+c3.96)/3), c.0vsc.48=((c1.0+c2.0+c3.0+c4.0)/4)-((c1.48+c2.48+c3.48)/3), c.0vsc.96=((c1.0+c2.0+c3.0+c4.0)/4)-((c1.96+c2.96+c3.96)/3), s.0vsc.0=((s1.0+s2.0+s3.0)/3)-((c1.0+c2.0+c3.0+c4.0)/4), s.24vsc.24=((s1.24+s2.24+s3.24+s4.24)/4)-((c1.24+c2.24+c3.24)/3), s.48vsc.48=((s1.48+s2.48+s3.48+s4.48)/4)-((c1.48+c2.48+c3.48)/3), s.96vsc.96=((s1.96+s2.96+s3.96+s4.96)/4)-((c1.96+c2.96+c3.96)/3), levels=design)



I received this error message with the above script:



Error: unexpected ',' in "cont.matrix <- makeContrasts(s.0vss.24=(((s1.0+s2.0+s3.0)/3)-((s1.24+s2.24+s3.24+s4.24)/4),"

Can you guide me as how to formulate the cont.matrix for the desired comparisons?

	[[alternative HTML version deleted]]

