[BioC] limma Two-sample model

Gordon Smyth smyth at wehi.edu.au
Wed Jun 25 13:19:47 MEST 2003


At 06:18 AM 25/06/2003, leon ding wrote:

>Hi,
>
>I tried to use limma two-sample experiment. I got error when doing lm.series.
>
>below is the scripts of what happened. Could somebody tell me what is 
>going wrong?
>
>Leon
>
>  > RG <- read.maimages(slides,source="genepix",wt.fun=wtflags(0.0))
>Read s1.gpr
>Read s2.gpr
>Read s3.gpr
>Read c1.gpr
>Read c2.gpr
>Read c3.gpr
> > RG$R[1:4,]
>        s1   s2   s3  c1   c2  c3
>[1,]  640 1154  532 262  963 413
>[2,]  760 1085  511 220  507 286
>[3,] 2966 4866 1997 866 2186 978
>[4,]  588  871  396 286  678 304
> > MAraw <- MA.RG(RG)
> > MA <- normalizeWithinArrays(RG,layout)
> > design <- read.table("design.txt",header=TRUE,sep="\t",as.is=TRUE)
> > design
>    ConRef SampCon
>s1      1       1
>s2      1       1
>s3      1       1
>c1      1       0
>c2      1       0
>c3      1       0
> > fit <- lm.series(MA$M,design)
>Error in as.double.default(structure(list(ConRef = c(1, 1, 1, 1, 1, 1),  :
>         (list) object cannot be coerced to vector type 14

Well, this is one of those somewhat subtle things in R which LIMMA is not 
yet developed enough to protect you from. The function 'read.table' creates 
a 'data.frame', which is like a spreadsheet in excel. A 'data.frame' can 
sometimes be treated as a 'matrix', but it is not a matrix. On the other 
hand, 'lm.series' expects to get a matrix for the design matrix. So you need

   design <- as.matrix(design)
   fit <- lm.series(MA$M, design)

Gordon



More information about the Bioconductor mailing list