Skip to content

Commit

Permalink
Add mondo#abbreviation synonym type axiom annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
joeflack4 committed Aug 30, 2024
1 parent dc3c79a commit a040c29
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion omim2obo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,19 @@ def omim2obo(use_cache: bool = False):
else:
graph.add((omim_uri, RDFS.label, Literal(label_cleaner.clean(label))))

# Reify on abbreviations. See: https://github.com/monarch-initiative/omim/issues/2
exact_labels = [s.strip() for s in label.split(';')]
# the last string is an abbreviation. Add OWL reification. See issue #2
if len(exact_labels) > 1:
abbr = exact_labels.pop()
graph.add((omim_uri, oboInOwl.hasExactSynonym, Literal(abbr)))
# Acronym: uppercase, no numbers, no whitespace, <10 chars
if abbr.isupper() and not any(char.isspace() for char in abbr) and len(abbr) < 10:
axiom = BNode()
graph.add((axiom, RDF.type, OWL.Axiom))
graph.add((axiom, OWL.annotatedSource, omim_uri))
graph.add((axiom, OWL.annotatedProperty, oboInOwl.hasExactSynonym))
graph.add((axiom, OWL.annotatedTarget, Literal(abbr)))
graph.add((axiom, oboInOwl.hasExactSynonym, MONDONS.abbreviation))
for exact_label in exact_labels:
graph.add((omim_uri, oboInOwl.hasExactSynonym, Literal(label_cleaner.clean(exact_label, abbrev))))
for label in other_labels:
Expand Down

0 comments on commit a040c29

Please sign in to comment.