[BioC] FW: SetMethod for Combine

Mercier Eloi Eloi.Mercier at ircm.qc.ca
Thu May 20 19:22:16 CEST 2010


Dear mailing list,

I'm developping a bioconductor package. I 'm using a method called "combine". This method is already defined in Biobase
Thus, to avoid an overwriting of my method, I import the "combine" method from Biobase.

However, I get some difficulties to add new parameters to this method.

> library(Biobase)

setMethod("combine",
signature(x="numeric", y="numeric"),
function(x, y, test=TRUE,...)
{
    return(sum(x,y))
})

> combine(1,2)
[1] 3 #OK
> combine(1,2, test=TRUE)
Error in do.call(callGeneric, list(y, ...)) :
  element 1 is empty;
   the part of the args list of 'list' being evaluated was:
   (y, ...)
Error in combine(x, do.call(callGeneric, list(y, ...))) :
  error in evaluating the argument 'y' in selecting a method for function 'combine'
Error in combine(x, do.call(callGeneric, list(y, ...))) :
  error in evaluating the argument 'y' in selecting a method for function 'combine'


This is due to the definition of the method by Biobase :

> library(Biobase)
>combine
nonstandardGenericFunction for "combine" defined from package "Biobase"

function (x, y, ...)
{
    if (length(list(...)) > 0) {  #HERE IS MY PROBLEM
        callGeneric(x, do.call(callGeneric, list(y, ...)))
    }
    else {
        standardGeneric("combine")
    }
}
<environment: 0x102ddea00>
Methods may be defined for arguments: x, y
Use  showMethods("combine")  for currently available ones.

The function's looking for futher arguments and calls different functions depending of that.
I'm not able to enter inside the "else" if I add any arguments.

Is there any way to avoid that ?

Thanks.

------------------------------------------
Eloi Mercier
Computational Biology, IRCM
110 av. Des Pins O.
Montreal
Canada, QC



More information about the Bioconductor mailing list