Skip to content

Commit

Permalink
Add OBO Foundry check function (#1356)
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt authored Jan 13, 2025
1 parent a33917d commit 5ee7c2b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/bioregistry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
has_no_terms,
is_deprecated,
is_novel,
is_obo_foundry,
is_proprietary,
normalize_curie,
normalize_parsed_curie,
Expand Down
16 changes: 16 additions & 0 deletions src/bioregistry/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"get_obo_download",
"get_json_download",
"get_owl_download",
"is_obo_foundry",
"get_rdf_download",
"get_version",
"get_banana",
Expand Down Expand Up @@ -775,6 +776,21 @@ def is_proprietary(prefix: str) -> Optional[bool]:
return entry.proprietary


def is_obo_foundry(prefix: str) -> Optional[bool]:
"""Get if the prefix has an OBO Foundry link.
:param prefix: The prefix to look up
:returns: If the prefix corresponds to an OBO Foundry resource
>>> assert is_obo_foundry('chebi')
>>> assert not is_proprietary('pdb')
"""
entry = get_resource(prefix)
if entry is None:
return None
return entry.get_obofoundry_prefix() is not None


def parse_curie(
curie: str,
*,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_paper_ranking.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Test for checking the paper ranking model."""

import json
import datetime
import json
import unittest
from pathlib import Path
from unittest.mock import patch
Expand Down

0 comments on commit 5ee7c2b

Please sign in to comment.