Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Alternative symbol" synonyms & "formerly" updates #132

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 26 additions & 25 deletions omim2obo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def omim2obo(use_cache: bool = False):
# - Non-OMIM triples
graph.add((URIRef('http://purl.obolibrary.org/obo/mondo/omim.owl'), RDF.type, OWL.Ontology))
graph.add((URIRef(oboInOwl.hasSynonymType), RDF.type, OWL.AnnotationProperty))
graph.add((URIRef(MONDONS.omim_included), RDF.type, OWL.AnnotationProperty))
graph.add((URIRef(MONDONS.includedEntryInOMIM), RDF.type, OWL.AnnotationProperty)) # like an rdfs:label subClass
graph.add((URIRef(OMO['0003000']), RDF.type, OWL.AnnotationProperty))
graph.add((BIOLINK['has_evidence'], RDF.type, OWL.AnnotationProperty))
graph.add((TAX_URI, RDF.type, OWL.Class))
Expand Down Expand Up @@ -202,7 +202,6 @@ def omim2obo(use_cache: bool = False):
get_alt_and_included_titles_and_symbols(alt_titles_str)
included_titles, included_symbols, former_included_titles, former_included_symbols = \
get_alt_and_included_titles_and_symbols(inc_titles_str)
included_is_included = included_titles or included_symbols # redundant. can't be included symbol w/out title

# Special cases depending on OMIM term type
is_gene = omim_type == OmimType.GENE or omim_type == OmimType.HAS_AFFECTED_FEATURE
Expand Down Expand Up @@ -233,50 +232,52 @@ def omim2obo(use_cache: bool = False):
pref_abbrev: Union[str, None] = None if not pref_symbols else pref_symbols[0]
joeflack4 marked this conversation as resolved.
Show resolved Hide resolved

# Add synonyms
# - exact titles
# - exact synonyms: titles
graph.add((omim_uri, oboInOwl.hasExactSynonym, Literal(label_cleaner.clean(pref_title, pref_abbrev))))
for title in alt_titles:
graph.add((omim_uri, oboInOwl.hasExactSynonym, Literal(label_cleaner.clean(title, pref_abbrev))))
# - exact abbreviations
for abbrevs in [pref_symbols, alt_symbols]:
for abbreviation in abbrevs:
add_triple_and_optional_annotations(graph, omim_uri, oboInOwl.hasExactSynonym, abbreviation,
# - exact synonyms: abbreviations
for symbols in [pref_symbols, alt_symbols]:
for symbol in symbols:
add_triple_and_optional_annotations(graph, omim_uri, oboInOwl.hasExactSynonym, symbol,
[(oboInOwl.hasSynonymType, OMO['0003000'])])
# - related, deprecated 'former' titles
# - related, deprecated 'former' synonyms: titles
for title in former_alt_titles:
clean_title = label_cleaner.clean(title, pref_abbrev)
add_triple_and_optional_annotations(graph, omim_uri, oboInOwl.hasRelatedSynonym, clean_title,
[(OWL.deprecated, Literal(True))])
# - related, deprecated 'former' abbreviations
for abbreviation in former_alt_symbols:
add_triple_and_optional_annotations(graph, omim_uri, oboInOwl.hasRelatedSynonym, abbreviation,
[(OWL.deprecated, Literal(True)), (oboInOwl.hasSynonymType, OMO['0003000'])])
add_triple_and_optional_annotations(graph, omim_uri, oboInOwl.hasExactSynonym, clean_title)
add_triple_and_optional_annotations(graph, omim_uri, URIRef(MONDONS.omimFormerly), clean_title)
# - related, deprecated 'former' synonyms: abbreviations
for symbol in former_alt_symbols:
add_triple_and_optional_annotations(graph, omim_uri, oboInOwl.hasExactSynonym, symbol,
[(oboInOwl.hasSynonymType, OMO['0003000'])])
# Though these are abbreviations, MONDONS.omimFormerly is not (yet) a synonym
# type, so can't add axiom: (oboInOwl.hasSynonymType, OMO['0003000'])
add_triple_and_optional_annotations(graph, omim_uri, URIRef(MONDONS.omimFormerly), symbol)

# Add 'included' entries
# - comment
if included_is_included:
if included_titles: # fyi: only need to check titles; there will never be included symbols w/out titles
included_comment = "This term has one or more labels that end with ', INCLUDED'."
graph.add((omim_uri, RDFS['comment'], Literal(included_comment)))
# - titles
for title in included_titles:
graph.add((omim_uri, URIRef(MONDONS.omim_included), Literal(label_cleaner.clean(title, pref_abbrev))))
graph.add((omim_uri, URIRef(MONDONS.includedEntryInOMIM), Literal(label_cleaner.clean(title, pref_abbrev))))
# - symbols
for symbol in included_symbols:
add_triple_and_optional_annotations(graph, omim_uri, URIRef(MONDONS.omim_included), symbol, [
# Though these are abbreviations, MONDONS.omim_included is not a synonym type, so can't add axiom:
add_triple_and_optional_annotations(graph, omim_uri, URIRef(MONDONS.includedEntryInOMIM), symbol, [
# Though these are abbreviations, MONDONS.includedEntryInOMIM is not a synonym type, so can't add axiom:
# (oboInOwl.hasSynonymType, OMO['0003000'])
])
# - deprecated, 'former'
for title in former_included_titles:
clean_title = label_cleaner.clean(title, pref_abbrev)
add_triple_and_optional_annotations(graph, omim_uri, URIRef(MONDONS.omim_included), clean_title,
[(OWL.deprecated, Literal(True))])
add_triple_and_optional_annotations(graph, omim_uri, URIRef(MONDONS.includedEntryInOMIM), clean_title)
add_triple_and_optional_annotations(graph, omim_uri, URIRef(MONDONS.omimFormerly), clean_title)
for symbol in former_included_symbols:
add_triple_and_optional_annotations(graph, omim_uri, URIRef(MONDONS.omim_included), symbol, [
(OWL.deprecated, Literal(True)),
# Though these are abbreviations, MONDONS.omim_included is not a synonym type, so can't add axiom:
# (oboInOwl.hasSynonymType, OMO['0003000'])
])
# Though these are abbreviations, MONDONS.includedEntryInOMIM & MONDONS.omimFormerly is not (yet) a synonym
# type, so can't add axiom: (oboInOwl.hasSynonymType, OMO['0003000'])
add_triple_and_optional_annotations(graph, omim_uri, URIRef(MONDONS.includedEntryInOMIM), symbol)
add_triple_and_optional_annotations(graph, omim_uri, URIRef(MONDONS.omimFormerly), symbol)

# Gene ID
# Why is 'skos:exactMatch' appropriate for disease::gene relationships? - joeflack4 2022/06/06
Expand Down