Skip to content

Commit

Permalink
Use OMO standard labels
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt authored Oct 11, 2023
1 parent d465b76 commit e7a0e54
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/ncbitaxon.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
# See OMO properties at
# https://github.com/information-artifact-ontology/ontology-metadata/blob/master/src/templates/annotation_properties.tsv
predicates = {
"acronym": (broad_synonym, "OMO:0003000"), # abbreviation
"anamorph": (related_synonym, None),
"blast name": (related_synonym, None),
"common name": (exact_synonym, "OMO:0003003"), # layperson synonym
"equivalent name": (exact_synonym, None),
"genbank acronym": (broad_synonym, None),
"genbank anamorph": (related_synonym, None),
"genbank common name": (exact_synonym, None),
"genbank synonym": (related_synonym, None),
"in-part": (related_synonym, None),
"misnomer": (related_synonym, "OMO:0003007"), # misnomer
"misspelling": (related_synonym, "OMO:0003006"), # misspelling
"synonym": (related_synonym, None),
"scientific name": (exact_synonym, None),
"teleomorph": (related_synonym, None),
"acronym": (broad_synonym, "OMO:0003000", "abbreviation"),
"anamorph": (related_synonym, None, None),
"blast name": (related_synonym, None, None),
"common name": (exact_synonym, "OMO:0003003", "layperson synonym"),
"equivalent name": (exact_synonym, None, None),
"genbank acronym": (broad_synonym, None, None),
"genbank anamorph": (related_synonym, None, None),
"genbank common name": (exact_synonym, None, None),
"genbank synonym": (related_synonym, None, None),
"in-part": (related_synonym, None, None),
"misnomer": (related_synonym, "OMO:0003007", "misnomer"),
"misspelling": (related_synonym, "OMO:0003006", "misspelling"),
"synonym": (related_synonym, None, None),
"scientific name": (exact_synonym, None, None),
"teleomorph": (related_synonym, None, None),
}


Expand Down Expand Up @@ -114,7 +114,7 @@ def convert_synonyms(tax_id, synonyms):
for synonym, unique, name_class in synonyms:
if name_class in predicates:
synonym = escape_literal(synonym)
predicate, synonym_type_curie = predicates[name_class]
predicate, synonym_type_curie, _ = predicates[name_class]
if synonym_type_curie is None:
synonym_type_curie = "ncbitaxon:" + label_to_id(name_class)
output.append(
Expand Down Expand Up @@ -236,10 +236,11 @@ def convert(taxdmp_path, output_path, taxa=None):
"""
)

for label, (parent, curie) in predicates.items():
for ad_hoc_label, (parent, curie, label) in predicates.items():
parent = parent.replace("oboInOwl", "oio")
if curie is None:
if curie is None and label is None:
curie = f"ncbitaxon:{label_to_id(label)}"
label = ad_hoc_label
output.write(dedent(f"""
{curie} a owl:AnnotationProperty ;
rdfs:label "{label}"^^xsd:string ;
Expand Down

0 comments on commit e7a0e54

Please sign in to comment.