On 09/14/2017 02:23 PM, Laurent Gatto wrote:

On 14 September 2017 15:15, Hervé Pagès wrote:

Hi,

Note that right now the name of the Ontology getter matches the
name of the corresponding field in all our annotations:

    > library(org.Hs.eg.db)

    > org.Hs.egGO[["92610"]][["GO:0005622"]]
    $GOID
    [1] "GO:0005622"

    $Evidence
    [1] "IEA"

    $Ontology
    [1] "CC"

    > library(GO.db)

    > GOTERM[["GO:0005622"]]
    GOID: GO:0005622
    Term: intracellular
    Ontology: CC
    Definition: The living contents of a cell; the matter contained within
      (but not including) the plasma membrane, usually taken to exclude
      large vacuoles and masses of secretory or ingested material. In
      eukaryotes it includes the nucleus and cytoplasm.
    Synonym: internal to cell
    Synonym: nucleocytoplasm
    Synonym: protoplasm
    Synonym: protoplast

Also this name is consistent with what AmiGO is using:

    
https://urldefense.proofpoint.com/v2/url?u=http-3A__amigo.geneontology.org_amigo_term_GO-3A0005622&d=DwIDaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=C5z6CCl_bZRPFzlEDkMt_WvAUYZ-FsqlbLiWiOhwtpU&s=7Fnqfz8bxFJTmQb7gkCIn779mocUHt_thMKO5ibOKMc&e=

So I actually don't think that we should rename the Ontology getter,
sorry.

@Laurent: any chance you use something else in rols?

Ontology,character is the constructor for the Ontology class, so it fits
quite well.

Right but a quite high-level one. Not because a function returns
some kind of object means the function should be considered *the* constructor for that object. For example the makeTxDb*() functions
in GenomicFeatures fetch stuff from the internet and return a TxDb
object. If instead we were using a TxDb() generic and methods for
doing this, then TxDb() would be considered *the* constructor.

What I'm trying to say is that right now Ontology() is seen as *the*
constructor only because of its name. If you rename it something like
fetchOntology(), then it won't be considered to be *the* constructor
anymore ;-) It's really a situation where "l'habit fait le moine".


If I considered changing that constructor, I would also want to change
the name of the class (say something like OlsOntology) and all other
similar classes/constructor (Term, Properties, ...) to keep the naming
conventions withing the package consistent.

Here is how things are named in rols, according to the Ontology lookup
service (OLS): the ontology is GO, and CC, MF and BP are called
namespaces of that ontolgy. Wikipedia and the Gene Ontolfy site
(https://urldefense.proofpoint.com/v2/url?u=http-3A__geneontology.org_page_ontology-2Ddocumentation&d=DwIDaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=C5z6CCl_bZRPFzlEDkMt_WvAUYZ-FsqlbLiWiOhwtpU&s=_K4W_5MEXI4AD3dr3mN2-boAr0YR4_fdUQsq0dcTOy0&e=
 ) also refer to them
as domains.

Yeah, but the Gene Ontology folks also call this a sub-ontolgies,
or just an Ontology depending of the mood of the day :-/


go <- Ontology("GO")
go
Ontology: Gene Ontology (go)
   An ontology for describing the function of genes and gene products
    Loaded: 2017-09-13 Updated: 2017-09-14 Version: 2017-09-12
    49106 terms  67 properties  0 individuals
got <- terms(go)
got
Object of class 'Terms' with 49107 entries
  From the GO ontology
   GO:0005230, GO:0015276 ... GO:0032942, GO:0019987
trm <- got[["GO:0005622"]]
trm
A Term from the GO ontology: GO:0005622
  Label: intracellular
   The living contents of a cell; the matter contained within (but not
   including) the plasma membrane, usually taken to exclude large vacuoles
   and masses of secretory or ingested material. In eukaryotes it includes
   the nucleus and cytoplasm.
termOntology(trm)
[1] "go"
termNamespace(trm)
[1] "cellular_component"
table(unlist((termNamespace(got))))
biological_process cellular_component molecular_function
              30596               4309              12132

This is how this work for all 198 ontologies available through the OLS.

Nice! Was wondering if you considered using something like
fetchTerms(go) instead of terms(go) so the user gets a heads-up that
this will download (a lot of) stuff from the network and that it might
take a while. After calling go <- Ontogy("go") one could get the false
impression that everything is now inside the Ontogy object 'go'.
Of course using something like fetchTerms() instead of terms() would
make more sense if Ontogy() was also replaced with something like
fetchOntology().


I am going to leave things as they are for the moment (I anyway don't
have time now) and think a bit more about it.

Thanks anyway for considering doing changes in AnnotationDbi and for the
discussion.

No problem. Thanks for understanding that unfortunately we are stuck
with Ontology() because of more than 10 years of AnnotationDbi history
and hundreds of annotation packages.

BTW and FWIW it seems that the ontoCAT package is also doing something
with ontologies. It has Classification and DataRepresentation in its
biocViews field. Would these terms also be appropriated for rols?

Cheers,
H.


Best wishes,

Laurent

Thanks,
H.


On 09/12/2017 03:52 PM, Hervé Pagès wrote:
On 09/12/2017 01:58 PM, Vincent Carey wrote:
For this particular problem, it may be worth noting that

https://urldefense.proofpoint.com/v2/url?u=http-3A__geneontology.org_page_ontology-2Dstructure&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=ECJZN8XlNzgWTqEBbZjafknjX8AFaP25P-pVVk1_FnI&s=JGP585F0L1FCGBWgo2vmg1Tl4ieNB_z2HRGv0oEUVvk&e=


describes CC, MF, BP as "sub-ontologies" of GO.  AnnotationDbi might
replace
its Ontology() with subontology() to acquire those tokens.

Thanks Vince for the suggestion. I like subontology() as a replacement
for Ontology() in AnnotationDbi.

We'll make that change.

H.


On Tue, Sep 12, 2017 at 4:28 PM, Michael Lawrence
<lawrence.mich...@gene.com
wrote:

I think I'm going to vote for the policy that methods with identical
signatures are currently unsupported by the methods package. It's
tough to imagine how they might work in any reliable and natural way,
and they totally break the methods package currently.

In the grand scheme of things, generics should have constrained
semantics. If you guys can't reconcile the semantics, then you'll need
two different generics with the same name. But please think about the
users.

Michael


On Tue, Sep 12, 2017 at 1:06 PM, Laurent Gatto <lg...@cam.ac.uk> wrote:

Hi Herve,

I understand that there is a clash between the two identical methods.
Both packages seem to have good reasons to implement their own
`Ontology,character`. Such clashes are relatively frequent.

My issue really is that when unloading AnnotationDbi's namespace,
`Ontology,character` is removed from the methods' dispatch table, and
thus becomes unavailable to rols users. What really should happen is
that when AnnotationDbi's namespace is unloaded, the method in rols
works again, similar to what happens for function.

Is this something that is worth raising on R-devel?

Best wishes,

Laurent

On 12 September 2017 16:35, Hervé Pagès wrote:

Hi Laurent,

The 2 Ontology,character methods defined in AnnotationDbi and
rols do very different things. The 1st one expects a vector of
GO IDs and returns the GO sub-ontologies that they belong to:

   > Ontology(c("GO:0000009", "GO:0000012", "GO:0000006"))
GO:0000009 GO:0000012 GO:0000006
         "MF"       "BP"       "MF"

The 2nd one takes the name of an ontology and returns a
summary/description of it:

   > Ontology("efo")
Ontology: Experimental Factor Ontology (efo)
     The Experimental Factor Ontology (EFO) provides a systematic
     description of many experimental variables available in EBI
databases,
     and for external projects such as the NHGRI GWAS catalogue. It
combines
     parts of several biological ontologies, such as anatomy,
disease and
     chemical compounds. The scope of EFO is to support the annotation,
     analysis and visualization of data handled by many groups at
the EBI
     and as the core ontology for OpenTargets.org
      Loaded: 2017-08-16 Updated: 2017-09-12 Version: 2.87
      20063 terms  297 properties  0 individuals

So the problem here is that even though now we have a single Ontology
generic in BiocGenerics for the 2 methods, we haven't really talked
about semantics i.e. what Ontology() is actually supposed to do.
Having
a generic without some sort of contract that methods are supposed to
honor is like having a generic called doSomething() and have people
start writing a bunch of methods for it ;-)

The right thing to do here would be to use 2 different generics with
2 different names e.g. Ontology() in AnnotationDbi and
ontologySummary()
in rols. Or GOontology() in AnnotationDbi and Ontology() in rols.

If we want to keep the current situation and make it work properly, we
could implement the following hack: have rols depend on AnnotationDbi
and make the method in rols work on GO ids. The code would just need
to detect whether the strings in the supplied character vector start
with the "GO:" prefix and delegate to the code in AnnotationDbi (this
means that rols would need to be able to call that code so the body
of the AnnotationDbi method would need to be moved to an helper
function). An ugly hack though!

What do you want to do?

H.

On 09/03/2017 07:59 AM, Laurent Gatto wrote:

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
https://urldefense.proofpoint.com/v2/url?u=http-3A__cpu.sysbiol.cam.ac.uk_&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=ECJZN8XlNzgWTqEBbZjafknjX8AFaP25P-pVVk1_FnI&s=8m_hDI6K7TnMToJXMG5Ud2QFHJfsppSA93X-dX5rne0&e=

https://urldefense.proofpoint.com/v2/url?u=http-3A__lgatto.github.io_&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=ECJZN8XlNzgWTqEBbZjafknjX8AFaP25P-pVVk1_FnI&s=n_IeMmaEdWX1VL_8OXRo8V20H4tUGDol4ESVrf8eUVg&e=


_______________________________________________
Bioc-devel@r-project.org mailing list
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=ECJZN8XlNzgWTqEBbZjafknjX8AFaP25P-pVVk1_FnI&s=hZlM1vvmu1PhUWy5mGpZ8c-eK0c8aILEnqQG4Wc12y0&e=


_______________________________________________
Bioc-devel@r-project.org mailing list
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=ECJZN8XlNzgWTqEBbZjafknjX8AFaP25P-pVVk1_FnI&s=hZlM1vvmu1PhUWy5mGpZ8c-eK0c8aILEnqQG4Wc12y0&e=



     [[alternative HTML version deleted]]

_______________________________________________
Bioc-devel@r-project.org mailing list
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=ECJZN8XlNzgWTqEBbZjafknjX8AFaP25P-pVVk1_FnI&s=hZlM1vvmu1PhUWy5mGpZ8c-eK0c8aILEnqQG4Wc12y0&e=






--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to