Hello all,

    Let me try this again with some code.

I am trying to make a new object and it's not working. I get :

Error in rematchDefinition(definition, fdef, mnames, fnames, signature) :
        methods can add arguments to the generic only if '...' is an
argument to the generic

as my error. I have included my code. It is from the xcms package.
Any help would be great even if it's just telling me what the error
means. I know that if I make "searchM" a normal function that it works
but I would really like a method.

Thank

Paul

require(methods) || stop("Couldn't load package methods")

setClass("xcmsRaw", representation(env = "environment", tic = "numeric",
                                   scantime = "numeric", scanindex =
"integer",
                                   profmethod = "character", profparam =
"list",
                                   mzrange = "numeric", gradient =
"matrix",
                                   msmsinfo = "matrix",MSMSmz= "vector",
MSMSpreMZ = "vector",
                   MSMSint = "vector", MSMSrt = "vector", MSMSpreZ =
"vector",
                   MSMScount= "vector"),
         prototype(env = new.env(parent=.GlobalEnv), tic = numeric(0),
                   scantime = numeric(0), scanindex = integer(0),
                   profmethod = "bin", profparam = list(),
                   mzrange = numeric(0),
                   gradient = matrix(nrow=0, ncol=0),
                   msmsinfo = matrix(nrow=0, ncol=0),
           MSMSmz= vector(), MSMSpreMZ = vector(),
           MSMSint = vector(), MSMSrt = vector(),
           MSMSpreZ = vector(), MSMScount= vector() ))

if ( !isGeneric("searchM") )
    setGeneric("searchM", function(object, ...) standardGeneric("searchM"))

setMethod("searchMetlin", "xcmsRaw", function(object, cost=5, ppm=10) {
    metlinfile<-url("http://";) # need to add URL
    met.xml<-read.metlin(metlinfile)
    Pcount<[EMAIL PROTECTED]
    values<-matrix(nrow=length(Pcount), ncol= 6)
    colnames(values)<-c("Name", "Distance", "precursor MZ", "precursor
Z", "rt", "MS/MS peaks")
    for(i in length(Pcount)){
    if(MSMSpeaks){
        MSMSpeaks<-as.vector([EMAIL PROTECTED]:Pcount[i]])
        rtMSpeaks<-as.vector([EMAIL PROTECTED])
        preMZ<-as.vector([EMAIL PROTECTED])
        preZ<-as.vector([EMAIL PROTECTED])
        }else{
        MSMSpeaks<-as.vector([EMAIL PROTECTED]:Pcount[i]])
        rtMSpeaks<-as.vector([EMAIL PROTECTED])
        preMZ<-as.vector([EMAIL PROTECTED])
        preZ<-as.vector([EMAIL PROTECTED])
    }
    decide<-decideBest(met.xml, MSMSpeaks, cost, ppm)
    if(decide$levenshtein<5){
        print(preMZ)
        temp.values<-c(met.xml[decide$indexNum,1], decide$levenshtein,
preMZ, preZ,rtMSpeaks,
            paste(MSMSpeaks, collapse=":"))
        values<-rbind(values,temp.values)
    } #else cat(".")  ?
    }
    return(values)
    write.csv(values, file="xcms.tsv", col.names=NA, sep="\t")
   
})

-- 
Research Technician
Mass Spectrometry
   o The
  /
o Scripps
  \
   o Research
  /
o Institute

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to