Hello all,
I consider myself pretty new to the whole OO based programming so
I'm sorry if I'm doing something stupid.
> xml<-read.metlin(url)
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "read.metlin",
for signature "url"
>read.metlin
standardGeneric for "read.metlin" defined from package
".GlobalEnv"
function (xml, ...)
standardGeneric("read.metlin")
<environment: 0x83a8ae4>
Methods may be defined for arguments: xml
> url
description
"http://metlin.scripps.edu/download/MSMS_test.XML"
class
"url"
mode
"r"
text
"text"
opened
"closed"
can read
"yes"
can write
"no"
I defined my methods as :
if (!isGeneric("read.metlin") )
setGeneric("read.metlin", function(xml)
standardGeneric("read.metlin"))
setMethod("read.metlin", "xcmsRaw", function(xml) {
#Parsing the METLIN XML File
reading<-readLines(xml)
# do rest of script
})
Any help as to why I'm getting the inherited method error would be great.
Cheers,
Paul
Hi Paul, "H. Paul Benton" <hpbenton at scripps.edu> writes:> I consider myself pretty new to the whole OO based programming so > I'm sorry if I'm doing something stupid.These sorts of questions might be better sent to the R-devel list...>> xml<-read.metlin(url) > Error in function (classes, fdef, mtable) : > unable to find an inherited method for function "read.metlin", > for signature "url"So the error message is telling you that it can't find a method for the read.metlin generic that matches the class of the xml argument you passed in. You defined:> setMethod("read.metlin", "xcmsRaw", function(xml) { > #Parsing the METLIN XML File > reading<-readLines(xml) > # do rest of script > > })So there is a method for read.metlin when the xml argument is an xcmsRaw object. As you show, you passed in an object with class "url".>> url > description > "http://metlin.scripps.edu/download/MSMS_test.XML" > class > "url"> Any help as to why I'm getting the inherited method error would be > great.You either need to add a method specialized on the url class (warning, url is not an S4 class, there will be tricks required). Or you need to pass in an xcmsRaw object. Cheers, + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center BioC: http://bioconductor.org/ Blog: http://userprimary.net/user/