Entering edit mode
Jenny Drnevich
★
2.2k
@jenny-drnevich-382
Last seen 10.3 years ago
Hi Gordon,
The gcrma.pres object from the previous example was created by
subsetting an object created by gcrma() on an AffyBatch object (code
below). I get the same error if I use the original ExpressionSet
object created by gcrma() and if I use an ExpressionSet object
created by rma(). I would assume that rma() and gcrma() would output
real ExpressionSet objects?!? Actually, calling as.matrix() on any
of my ExpressionSet objects works fine on it's own, but somehow not
within duplicateCorrelation (see code) - how can this be?
Thanks,
Jenny
> raw <- ReadAffy()
> gcrma.all <- gcrma(raw)
> gcrma.pres <- gcrma.all[num.pres>0,]
> corfit <-
duplicateCorrelation(gcrma.pres,design,ndups=1,block=c(2,2,1,1,3,3))
Error in as.vector(x, mode) : cannot coerce to vector
> corfit <-
duplicateCorrelation(gcrma.all,design,ndups=1,block=c(2,2,1,1,3,3))
Error in as.vector(x, mode) : cannot coerce to vector
> rma.all <- rma(raw)
Background correcting
Normalizing
Calculating Expression
> corfit <-
duplicateCorrelation(rma.all,design,ndups=1,block=c(2,2,1,1,3,3))
Error in as.vector(x, mode) : cannot coerce to vector
> temp <- as.matrix(rma.all)
#this works fine, but somehow not in duplicateCorrelation!!!
From the debugger:
Browse[1]> M <- as.matrix(object)
Error in as.vector(x, mode) : cannot coerce to vector
>class(raw)
[1] "AffyBatch"
attr(,"package")
[1] "affy"
> class(gcrma.all)
[1] "ExpressionSet"
attr(,"package")
[1] "Biobase"
> class(gcrma.pres)
[1] "ExpressionSet"
attr(,"package")
[1] "Biobase"
> typeof(raw)
[1] "S4"
> typeof(gcrma.all)
[1] "S4"
> typeof(gcrma.pres)
[1] "S4"
At 05:59 PM 5/16/2007, Gordon K Smyth wrote:
>Dear Jenny,
>
>limma already has an as.matrix method for ExpressionSet
>objects. I've just run the following code
>which demonstrates that duplicateCorrelation() does work on such
objects:
>
> > library(Biobase)
> > library(limma)
> > x <- matrix(rnorm(50*4),50,4)
> > y <- new("ExpressionSet",exprs=x)
> > dupcor <- duplicateCorrelation(y,ndups=2)
> Loading required package: statmod
> > dupcor$consensus
> [1] -0.07112392
>
>I suspect that your data object is not actually an ExpressionSet
>object, although perhaps it is
>something which inherits from ExpressionSet. I can't tell from your
>code where you object has
>come from or what class it is.
>
>Because as.matrix() is an S3 generic, there is a problem with S4
>objects which inherit from
>ExpressionSet. Can you give more information about how your problem
arises?
>
>Best wishes
>Gordon
>
>On Thu, May 17, 2007 5:15 am, Jenny Drnevich wrote:
> > Hi Gordon and others,
> >
> > I just tried calling duplicateCorrelation on an ExpressionSet
object
> > with the newest versions of R, Bioconductor and limma (codes and
> > sessionInfo() below) and it won't work. I don't think the problem
> > lies with duplicateCorrelation() itself, rather that as.matrix()
does
> > not work for ExpressionSet objects whereas it did work for exprSet
> > objects. The help file for duplicateCorrelation has this
description
> > for the input object:
> >
> > "a numeric matrix of expression values, or any data object from
which
> > as.matrix will extract a suitable matrix such as an
> >
> <mk:@msitstore:c:\progra~1\r\r-25~1.0\library\limma\chtml\limma.chm: :="" malist.html="">MAList,
> > marrayNorm or exprSet object."
> >
> > The code and error:
> >
> > > corfit <-
> >
duplicateCorrelation(gcrma.pres,design,ndups=1,block=c(2,2,1,1,3,3))
> > Error in as.vector(x, mode) : cannot coerce to vector
> >
> > From debugging duplicateCorrelation, the problem is in the very
> > first line of code:
> >
> > Browse[1]> M <- as.matrix(object)
> > Error in as.vector(x, mode) : cannot coerce to vector
> >
> >
> > If you don't intend as.matrix() to work for ExpressionSet objects,
> > then the code for duplicateCorrelation maybe should be changed. Of
> > course, the easy work-around is to pass exprs(gcrma.pres) to
> > duplicateCorrelation.
> >
> > Cheers,
> > Jenny
> >
> > > sessionInfo()
> > R version 2.5.0 (2007-04-23)
> > i386-pc-mingw32
> >
> > locale:
> > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> > States.1252;LC_MONETARY=English_United
> > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> >
> > attached base packages:
> > [1] "splines" "tools" "stats" "graphics" "grDevices"
"utils"
> > [7] "datasets" "methods" "base"
> >
> > other attached packages:
> > hgu133plus2probe hgu133plus2cdf affyQCReport
geneplotter
> > "1.16.0" "1.16.0" "1.14.0"
"1.14.0"
> > RColorBrewer simpleaffy made4
scatterplot3d
> > "0.2-3" "2.10.11" "1.10.0"
"0.3-24"
> > ade4 affyPLM affydata
affycoretools
> > "1.4-3" "1.12.0" "1.11.2"
"1.8.0"
> > annaffy xtable gcrma
matchprobes
> > "1.8.1" "1.4-3" "2.8.0"
"1.8.0"
> > biomaRt RCurl XML
GOstats
> > "1.10.0" "0.8-0" "1.7-1"
"2.2.1"
> > Category Matrix lattice
genefilter
> > "2.2.2" "0.9975-11" "0.15-4"
"1.14.1"
> > survival KEGG RBGL
annotate
> > "2.31" "1.16.0" "1.12.0"
"1.14.1"
> > GO graph limma
affy
> > "1.16.0" "1.14.0" "2.10.0"
"1.14.0"
> > affyio Biobase RWinEdt
> > "1.4.0" "1.14.0" "1.7-5"
> > >
> >
> >
> > Jenny Drnevich, Ph.D.
> >
> > Functional Genomics Bioinformatics Specialist
> > W.M. Keck Center for Comparative and Functional Genomics
> > Roy J. Carver Biotechnology Center
> > University of Illinois, Urbana-Champaign
> >
> > 330 ERML
> > 1201 W. Gregory Dr.
> > Urbana, IL 61801
> > USA
> >
> > ph: 217-244-7355
> > fax: 217-265-5066
> > e-mail: drnevich at uiuc.edu
Jenny Drnevich, Ph.D.
Functional Genomics Bioinformatics Specialist
W.M. Keck Center for Comparative and Functional Genomics
Roy J. Carver Biotechnology Center
University of Illinois, Urbana-Champaign
330 ERML
1201 W. Gregory Dr.
Urbana, IL 61801
USA
ph: 217-244-7355
fax: 217-265-5066
e-mail: drnevich at uiuc.edu