[Bioc-devel] unexpected interaction of "exprSet" and "DBI" package

Martin Morgan mtmorgan at fhcrc.org
Sun Apr 15 03:03:08 CEST 2007


I wonder if it's a bug in methods?

> setClass("A", contains="list")
[1] "A"
> as(list(), "A")
An object of class "A"
list()
> library(DBI)
Error in .mergeMethodsTable(generic, mtable, get(tname, envir = env),  : 
	Invalid object in meta table of methods for "coerce", label "list#A", had class "function"

The method table entry for the auto-generated 'as' is a simple function

> get(".MTable", environment(coerce))[["list#A"]]
function (from, to) 
{
    obj <- new("A")
    as(obj, "list") <- from
    obj
}
<environment: namespace:methods>

whereas all the other entries are

> class(get(".MTable", environment(coerce))[["ANY#vector"]])
[1] "MethodDefinition"
attr(,"package")
[1] "methods"

If so, the culprit is methods:::.asFromReplace, called from
methods::as.

Martin

> sessionInfo()
R version 2.6.0 Under development (unstable) (2007-04-06 r41065) 
x86_64-unknown-linux-gnu 

locale:
LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=en_US;LC_COLLATE=en_US;LC_MONETARY=en_US;LC_MESSAGES=en_US;LC_PAPER=en_US;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US;LC_IDENTIFICATION=C

attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"  
[7] "base"     


Seth Falcon <sfalcon at fhcrc.org> writes:

> Wolfgang Huber <huber at ebi.ac.uk> writes:
>
>> Hi
>>
>> has anybody seen the following phenomenon before or have an idea whether 
>> it is to be considered a bug in either methods, Biobase or DBI?
>
> Not until now.
>
>> library("Biobase")
>> new("exprSet", description = new("MIAME"))
>> library("DBI")
>>
>> Error in .mergeMethodsTable(generic, mtable, get(tname, envir = env),  :
>>          Invalid object in meta table of methods for "coerce", label 
>> "list#Versions", had class "function"
>>
>> Thanks to Jelle Goeman, who pointed out a version of this problem. My 
>> attempts to more closely locate the origin have so far not been 
>> successul. The error does not occur when 'description = new("MIAME")' is 
>> omitted.
>
> Very odd.  The NAMESPACE file in DBI was exporting a coerce method
> when it should not have (there is no call to setAs).  Removing the
> coerce export from DBI seems to have made the problem go away.  I will
> send an update to CRAN.
>
> Still, this seems buggy to me: I would expect at least a warning about
> exporting methods that you don't define in any way.  And not ending up
> with a corrupt methods table would be nice.
>
> Thanks for the report.
>
> Bw,
>
> + seth
>
> -- 
> Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
> http://bioconductor.org
>
> _______________________________________________
> Bioc-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

-- 
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org



More information about the Bioc-devel mailing list