Parse OBO Graph edge axiom annotations into Biolink evidence/provenance slots - #561
Open
kevinschaper wants to merge 1 commit into
Open
Parse OBO Graph edge axiom annotations into Biolink evidence/provenance slots#561kevinschaper wants to merge 1 commit into
kevinschaper wants to merge 1 commit into
Conversation
OWL axiom annotations survive an obographs conversion as `edges[].meta`,
and it is where ontologies record why an assertion was made -- MONDO
alone annotates 47k of its 113k edges. ObographSource copied `meta`
verbatim into the record, so it reached a TSV as a Python-repr blob in a
`meta` column and no evidence or provenance ever landed on a Biolink
slot.
Map the annotations that have Biolink equivalents:
prov:wasDerivedFrom -> primary_knowledge_source, as an InfoRes CURIE
derived from the ontology file stem
dc:source / -> routed by value shape: PMID/doi to publications,
oboInOwl:source ORCID to agent_type=manual_agent,
MONDO:Inferred|Entailed to
knowledge_level=logical_entailment,
remaining CURIEs to xref
oboInOwl:evidence -> has_evidence
oboInOwl:is_inferred -> knowledge_level / agent_type
SSSOM slots and a short alias table (notes, comment, see_also,
term_tracker_item, creator, date, editor_note) keep columns of their own.
Everything else folds into `_annotations` as predicate=value pairs:
across PHENIO's components the tail of one-off per-ontology properties is
long and almost empty -- giving each its own column produced 57 edge
columns of which ~40 held nothing, against 25 columns now. Raw `source`
values are also kept verbatim in `_source`, so no annotation is lost.
Two data-quality fixes fall out of MONDO's hand-entered values:
"PMID: 16322613" loses the stray space, and "PMID:32181500, PMID:32905580"
splits into two references rather than one malformed CURIE.
The InfoRes derivation stays mechanical -- the file stem is used as-is --
because the registry does not agree with every stem (it lists "hpo", not
"hp") and a project's existing IDs should win over a guess. `infores_map`
overrides it, and prepare_input_args now passes that through so it can be
set from a transform config YAML instead of only in Python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OWL axiom annotations survive an obographs conversion as
edges[].meta, and that is where ontologies record why an assertion was made. MONDO annotates 47,249 of its 113,685 edges; PHENIO carries annotations on 1.42M of 1.67M.ObographSource.read_edgecopiedmetaverbatim into the record via its catch-all, so it reached the TSV as a Python-repr blob:No evidence or provenance ever reached a Biolink slot.
Change
prov:wasDerivedFromprimary_knowledge_source(InfoRes CURIE from the ontology file stem)dc:source/oboInOwl:sourceoboInOwl:evidencehas_evidenceoboInOwl:is_inferredknowledge_level/agent_typesourcevalues are heterogeneous, so they route by shape:PMID:/doi:→publications; ORCID →agent_type=manual_agent;MONDO:Inferred/Entailed→knowledge_level=logical_entailment; remaining CURIEs →xref. A curator ORCID outranks the reasoner markers, since the ones MONDO also emits (Redundant,indirect) describe the axiom's position in the hierarchy rather than how it was arrived at. Every raw value is also kept in_source, so nothing is lost.The same MONDO edge now reads:
SSSOM slots and a short alias table (
notes,comment,see_also,term_tracker_item,creator,date,editor_note) keep named columns. Everything else folds into_annotationsaspredicate=valuepairs — across PHENIO's components the tail of one-off per-ontology properties (todo,quote,gene, even a misspelledcardonality) is long and nearly empty. Giving each its own column produced 57 edge columns of which ~40 were empty; the catch-all brings that to 25, and on 1.66M PHENIO edges_annotationsis non-empty on just 56 rows.Two data-quality fixes fall out of MONDO's hand-entered values:
"PMID: 16322613"loses the stray space, and"PMID:32181500, PMID:32905580"splits into two references instead of one malformed CURIE. Full MONDO run goes from 2 malformed CURIEs to 0.InfoRes derivation
The stem is used as-is (
components/mondo.owl→infores:mondo). Deliberately mechanical: the registry does not agree with every stem — it listsinfores:hpo, notinfores:hp— and a project's existing IDs should win over a guess.infores_mapoverrides it, andprepare_input_argsnow passes that through so it can be set from a transform config YAML rather than only in Python:Compatibility
This changes obojson edge output for all consumers: the
metacolumn is gone, replaced by the columns above. Downstream configs that declaremetaneed updating.Testing
7 new tests covering InfoRes derivation, value-shape routing, knowledge_level/agent_type precedence, evidence/passthrough, the catch-all, CURIE normalization, and the config passthrough — the last verified to fail without the
cli_utilschange. Fixture built from real PHENIO/MONDO edges.381 passed, 19 skipped, 1 failed— the failure istest_sink/test_jsonl_sink.py::test_write_jsonl2, which fails identically on unmodified master.Validated at scale: full
mondo.json(113,388 edges, 47s) and fullphenio.json(1.66M edges) —primary_knowledge_source54.5%,knowledge_level3.2%,xref2.8%,agent_type0.8%.