Skip to content

Commit 8132d39

Browse files
authored
Enable skipping maintainer annotations (#466)
This PR enables adding `skip_maintainers = True` to an OBO converter class to turn off outputting ontology-level maintainer annotations. This supports the HGNC use case, where the maintainers asked that they are not explicitly listed on the PyOBO third-party ontology conversion because they don't want it to be confused for them endorsing the product. Related discussion on how to best show this attribution on EBI OLS: EBISPOT/ols4#1025
1 parent 14d6940 commit 8132d39

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

src/pyobo/sources/hgnc/hgnc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ class HGNCGetter(Obo):
210210
for so_id in sorted(set(LOCUS_TYPE_TO_SO.values()))
211211
if so_id
212212
]
213+
skip_maintainers = True
213214

214215
def iter_terms(self, force: bool = False) -> Iterable[Term]:
215216
"""Iterate over terms in the ontology."""
@@ -342,6 +343,8 @@ def get_terms(version: str | None = None, force: bool = False) -> Iterable[Term]
342343
term.append_exact_match(
343344
Reference(prefix="iuphar.ligand", identifier=iuphar[len("ligandId:") :])
344345
)
346+
elif iuphar.startswith("HGNC:"):
347+
pass
345348
else:
346349
tqdm.write(f"[hgnc:{identifier}] unhandled IUPHAR: {iuphar}")
347350

src/pyobo/struct/struct.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,11 @@ class Obo:
611611

612612
ontology_version_iri: ClassVar[str | None] = None
613613

614+
#: Allow skipping adding maintainers annotations, in case
615+
#: the resource maintainers don't want their names associated
616+
#: with the OWL exports that e.g. end up on EBI OLS
617+
skip_maintainers: ClassVar[bool] = False
618+
614619
def __post_init__(self):
615620
"""Run post-init checks."""
616621
if self.ontology is None:
@@ -978,19 +983,22 @@ def _iterate_property_pairs(self) -> Iterable[Annotation]:
978983
yield Annotation(v.has_logo, OBOLiteral.uri(logo))
979984
if mailing_list := resource.get_mailing_list():
980985
yield Annotation(v.has_mailing_list, OBOLiteral.string(mailing_list))
981-
if (maintainer := resource.get_contact()) and maintainer.orcid:
982-
yield Annotation(
983-
v.has_maintainer,
984-
Reference(prefix="orcid", identifier=maintainer.orcid, name=maintainer.name),
985-
)
986-
for maintainer in resource.contact_extras or []:
987-
if maintainer.orcid:
986+
if not self.skip_maintainers:
987+
if (maintainer := resource.get_contact()) and maintainer.orcid:
988988
yield Annotation(
989989
v.has_maintainer,
990990
Reference(
991991
prefix="orcid", identifier=maintainer.orcid, name=maintainer.name
992992
),
993993
)
994+
for maintainer in resource.contact_extras or []:
995+
if maintainer.orcid:
996+
yield Annotation(
997+
v.has_maintainer,
998+
Reference(
999+
prefix="orcid", identifier=maintainer.orcid, name=maintainer.name
1000+
),
1001+
)
9941002

9951003
# Root terms
9961004
for root_term in self.root_terms or []:

0 commit comments

Comments
 (0)