[Bioc-devel] Identical methods in two packages

Laurent Gatto lg390 at cam.ac.uk
Sun Sep 3 16:59:55 CEST 2017


Dear all,

This is a follow up to a previous email regarding the Ontology generic
function, that is now in the BiocGenerics package. It seems that my
problem was not only that both rols and AnnotationDbi defined the same
generic, but they also both defined Ontology,character.

> library("rols")

This is 'rols' version 2.5.2 

> Ontology("go")
Ontology: Gene Ontology (go)  
  An ontology for describing the function of genes and gene products
   Loaded: 2017-08-31 Updated: 2017-09-01 Version: 2017-08-30 
   49075 terms  67 properties  0 individuals
> Ontology
standardGeneric for "Ontology" defined from package "BiocGenerics"

function (object) 
standardGeneric("Ontology")
<environment: 0x2da7cf0>
Methods may be defined for arguments: object
Use  showMethods("Ontology")  for currently available ones.
> showMethods("Ontology")
Function: Ontology (package BiocGenerics)
object="character"
object="Ontology"

> getMethod("Ontology", "character")
Method Definition:

function (object) 
{
    url <- ontologyUrl(object)
    x <- GET(url)
    stop_for_status(x)
    cx <- content(x)
    makeOntology(cx)
}
<environment: namespace:rols>

Signatures:
        object     
target  "character"
defined "character"

Until now, everything works as expected. The trouble begins when loading
AnnotationDbi.

> suppressPackageStartupMessages(library("AnnotationDbi"))
> showMethods("Ontology")
Function: Ontology (package BiocGenerics)
object="character"
object="GOTerms"
object="GOTermsAnnDbBimap"
object="Ontology"

> getMethod("Ontology", "character")
Method Definition:

function (object) 
.GOid2go_termField(object, "ontology")
<environment: namespace:AnnotationDbi>

Signatures:
        object     
target  "character"
defined "character"
> Ontology("go")
Loading required package: GO.db

<NA> 
  NA 

Ok, fair enough, these things happen. The issue is to recover
Ontology,character from rols. If I unload AnnotationDbi's namespace (I
also neet to unload GO.db, that got loaded automatically), there is no
Ontology,character anymore.

> unloadNamespace("GO.db")
> unloadNamespace("AnnotationDbi")
> showMethods("Ontology")
Function: Ontology (package BiocGenerics)
object="Ontology"

> Ontology("go")
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘Ontology’ for signature ‘"character"’
> rols::Ontology("go")
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘Ontology’ for signature ‘"character"’

> getMethod("Ontology", "character")
Error in getMethod("Ontology", "character") : 
  no method found for function 'Ontology' and signature character
> getMethod("Ontology", "character", where = "package:rols")
Method Definition:

function (object) 
{
    url <- ontologyUrl(object)
    x <- GET(url)
    stop_for_status(x)
    cx <- content(x)
    makeOntology(cx)
}
<environment: namespace:rols>

Signatures:
        object     
target  "character"
defined "character"


It is really the expected behaviour? How could I recover rols'
Ontology,character?

Thank you in advance.

Best wishes,

Laurent

-- 
Laurent Gatto | @lgatt0
http://cpu.sysbiol.cam.ac.uk/
http://lgatto.github.io/



More information about the Bioc-devel mailing list