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

Enable specifying version for sources #137

Merged
merged 3 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/pyobo/getters.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get_ontology(
return from_obonet(get_gzipped_graph(obonet_json_gz_path))

if has_nomenclature_plugin(prefix):
obo = run_nomenclature_plugin(prefix)
obo = run_nomenclature_plugin(prefix, version=version)
logger.info("[%s] caching nomenclature plugin", prefix)
obo.write_default(force=rewrite)
return obo
Expand Down
6 changes: 3 additions & 3 deletions src/pyobo/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""Tools for loading entry points."""

from functools import lru_cache
from typing import Callable, Iterable, Mapping
from typing import Callable, Iterable, Mapping, Optional

from .struct import Obo

Expand Down Expand Up @@ -33,11 +33,11 @@ def has_nomenclature_plugin(prefix: str) -> bool:
return True


def run_nomenclature_plugin(prefix: str) -> Obo:
def run_nomenclature_plugin(prefix: str, version: Optional[str] = None) -> Obo:
"""Get a converted PyOBO source."""
from .sources import ontology_resolver

return ontology_resolver.make(prefix)
return ontology_resolver.make(prefix, version=version)
cthoyt marked this conversation as resolved.
Show resolved Hide resolved


def iter_nomenclature_plugins() -> Iterable[Obo]:
Expand Down
2 changes: 1 addition & 1 deletion src/pyobo/sources/hgnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class HGNCGetter(Obo):

def iter_terms(self, force: bool = False) -> Iterable[Term]:
"""Iterate over terms in the ontology."""
return get_terms(force=force)
return get_terms(force=force, version=self.data_version)


def get_obo(*, force: bool = False) -> Obo:
Expand Down