biolink / ontobio

python library for working with ontologies and ontology associations
https://ontobio.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
119 stars 30 forks source link

Ontology.merge() should copy logical definitions and property chain axioms #504

Closed dustine32 closed 3 years ago

dustine32 commented 3 years ago

The merge function on Ontology https://github.com/biolink/ontobio/blob/61878238d0d6eb4dccb4b48a285f7b9ae5eac5f4/ontobio/ontol.py#L136 ...should transfer over all logical definitions and property chain axioms contained in supplied ontologies.

My use case here is merging RO into GO for use in gocamgen:

ontology_graph = OntologyFactory().create("go.json")
ontology_graph.merge(OntologyFactory().create("ro.json"))
pcas = ontology_graph.get_property_chain_axioms("RO:0002264") # acts upstream of or within
causally_upstream_relation = pcas[0].chain_predicate_ids[1] # causally upstream of or within

@dougli1sqrd I discovered this was missing when attempting to create our generic ontology object. I already have a fix with some tests to PR.