Hello Bioconductors:

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 feeling abit frustrated!!!!

The following script gives the error message:

cont.matrix<-makeContrasts(s0vss24=s.0-s.24, s24vss48=s.24-s.48, s48vss96=s.48-s.96, s0vss48=s.0-s.48, s0vss96=s.0-s.96, c0vsc24=c.0-c.24, c24vsc48=c.24-c.48, c48vsc96=c.48-c.96, c0vsc48=c.0-c.48, c0vsc96=c.0-c.96, s0vsc0=s.0-c.0, s24vsc24=s.24-c.24, s48vsc48=s.48-c.48, s96vsc96=s.96-c.96,levels=design)


Error in eval(expr, envir, enclos) : object "c96" not found.

Here is my script to that point:

#Read in targets file

 

targets <- readTargets("targets.txt")

 

 

targets

 

      FileName
     Species
     Time
     
      c0M1
     c
     0
     
      c0M2
     c
     0
     
      c0M3
     c
     0
     
      c0M4
     c
     0
     
      s0M1
     s
     0
     
      s0M2
     s
     0
     
      s0M3
     s
     0
     
      c24M1
     c
     24
     
      c24M2
     c
     24
     
      c24M3
     c
     24
     
      s24M1
     s
     24
     
      s24M2
     s
     24
     
      s24M3
     s
     24
     
      s24M4
     s
     24
     
      c48M1
     c
     48
     
      c48M2
     c
     48
     
      c48M3
     c
     48
     
      s48M1
     s
     48
     
      s48M2
     s
     48
     
      s48M3
     s
     48
     
      s48M4
     s
     48
     
      c96M1
     c
     96
     
      c96M2
     c
     96
     
      c96M3
     c
     96
     
      s96M1
     s
     96
     
      s96M2
     s
     96
     
      s96M3
     s
     96
     
      s96M4
     s
     96
     

 

 

# Set up character list defining your arrays, include replicates

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

#This script returns the following:

TS

#[1] "c.0"  "c.0"  "c.0"  "c.0"  "s.0"  "s.0"  "s.0"  "c.24" "c.24" "c.24"

#[11] "s.24" "s.24" "s.24" "s.24" "c.48" "c.48" "c.48" "s.48" "s.48" "s.48"

#[21] "s.48" "c.96" "c.96" "c.96" "s.96" "s.96" "s.96" "s.96"

# Turn TS into a factor variable which facilitates fitting

TS <- factor(TS)

#This script returns the following

TS

#[1] c.0  c.0  c.0  c.0  s.0  s.0  s.0  c.24 c.24 c.24 s.24 s.24 s.24 s.24 c.48

#[16] c.48 c.48 s.48 s.48 s.48 s.48 c.96 c.96 c.96 s.96 s.96 s.96 s.96

#Levels: c.0 c.24 c.48 c.96 s.0 s.24 s.48 s.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)

design

  c.0 c.24 c.48 c.96 s.0 s.24 s.48 s.96

1    1    0    0    0   0    0    0    0

2    1    0    0    0   0    0    0    0

3    1    0    0    0   0    0    0    0

4    1    0    0    0   0    0    0    0

5    0    0    0    0   1    0    0    0

6    0    0    0    0   1    0    0    0

7    0    0    0    0   1    0    0    0

8    0    1    0    0   0    0    0    0

9    0    1    0    0   0    0    0    0

10   0    1    0    0   0    0    0    0

11   0    0    0    0   0    1    0    0

12   0    0    0    0   0    1    0    0

13   0    0    0    0   0    1    0    0

14   0    0    0    0   0    1    0    0

15   0    0    1    0   0    0    0    0

16   0    0    1    0   0    0    0    0

17   0    0    1    0   0    0    0    0

18   0    0    0    0   0    0    1    0

19   0    0    0    0   0    0    1    0

20   0    0    0    0   0    0    1    0

21   0    0    0    0   0    0    1    0

22   0    0    0    1   0    0    0    0

23   0    0    0    1   0    0    0    0

24   0    0    0    1   0    0    0    0

25   0    0    0    0   0    0    0    1

26   0    0    0    0   0    0    0    1

27   0    0    0    0   0    0    0    1

28   0    0    0    0   0    0    0    1

attr(,"assign")

[1] 1 1 1 1 1 1 1 1

attr(,"contrasts")

attr(,"contrasts")$TS

[1] "contr.treatment"

colnames(design) <- levels(TS)

colnames(design)

#[1] "c.0"  "c.24" "c.48" "c.96" "s.0"  "s.24" "s.48" "s.96"

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

fit <- lmFit(eset, design)

#  and extract the

label for the difference = actual difference

#Contrasts desired:

      Comparisons
      
      
      Sockeye Over Time
     Formula
     
      
      s0 versus s24
     s0vss24=s.0-s.24,
     
      s24 versus s48
     s24vss48=s.24-s.48,
     
      s48 versus s96
     s48vss96=s.48-s.96,
     
      s0 versus s48
     s0vss48=s.0-s.48,
     
      s0 versus s96
     s0vss96=s.0-s.96,
     
      
      Coho Over Time
      
      
      c0 versus c24
     c0vsc24=c.0-c.24,
     
      c24 versus c48
     c24vsc48=c.24-c.48,
     
      c48 versus c96
     c48vsc96=c.48-c.96,
     
      c0 versus c48
     c0vsc48=c.0-c.48,
     
      c0 versus c96
     c0vsc96=c.0-c.96,
     
      
      
      Coho vs Sockeye
      
      
      s0 versus c0
     s0vsc0=s.0-c.0,
     
      s24 versus c24
     s24vsc24=s.24-c.24,
     
      s48 versus c48
     s48vsc48=s.48-c.48,
     
      s96 versus c96
     s96vsc96=s.96-c.96,
     

 

 

cont.matrix<-makeContrasts(s0vss24=s.0-s.24, s24vss48=s.24-s.48, s48vss96=s.48-s.96, s0vss48=s.0-s.48, s0vss96=s.0-s.96, c0vsc24=c.0-c.24, c24vsc48=c.24-c.48, c48vsc96=c.48-c.96, c0vsc48=c.0-c.48, c0vsc96=c.0-c.96, s0vsc0=s.0-c.0, s24vsc24=s.24-c.24, s48vsc48=s.48-c.48, s96vsc96=s.96-c.96,levels=design)

 

Error in eval(expr, envir, enclos) : object "c96" not found



	[[alternative HTML version deleted]]

