diff --git a/.github/workflows/check-dependencies.yaml b/.github/workflows/check-dependencies.yaml index 9a332b8..9d32dd7 100644 --- a/.github/workflows/check-dependencies.yaml +++ b/.github/workflows/check-dependencies.yaml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: [ "3.9", "3.10" ] + python: [ "3.9", "3.10", "3.11" ] # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/.github/workflows/initialize-toolkit-daily.yaml b/.github/workflows/initialize-toolkit-daily.yaml index 9a0eac3..cef81b7 100644 --- a/.github/workflows/initialize-toolkit-daily.yaml +++ b/.github/workflows/initialize-toolkit-daily.yaml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: [ "3.9", "3.10" ] + python: [ "3.9", "3.10", "3.11" ] # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8ec6c9c..c6bc5b2 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: [ "3.9", "3.10" ] + python: [ "3.9", "3.10", "3.11" ] # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/bmt/toolkit.py b/bmt/toolkit.py index 228186f..25a25d8 100644 --- a/bmt/toolkit.py +++ b/bmt/toolkit.py @@ -21,7 +21,7 @@ Url = str Path = str -LATEST_BIOLINK_RELEASE = "4.1.5" +LATEST_BIOLINK_RELEASE = "4.1.6" REMOTE_PATH = f"https://raw.githubusercontent.com/biolink/biolink-model/v{LATEST_BIOLINK_RELEASE}/biolink-model.yaml" PREDICATE_MAP = f"https://raw.githubusercontent.com/biolink/biolink-model/v{LATEST_BIOLINK_RELEASE}/predicate_mapping.yaml" @@ -884,8 +884,11 @@ def get_element(self, name: str) -> Optional[Element]: logger.debug(parsed_name) element = self.view.get_element(parsed_name) if element is None and self.view.all_aliases() is not None: + if parsed_name.startswith("biolink:"): + parsed_name = parsed_name.replace("biolink:", "") + parsed_name = parsed_name.replace("_", " ") for e in self.view.all_aliases(): - if name in self.view.all_aliases()[e]: + if name in self.view.all_aliases()[e] or parsed_name in self.view.all_aliases()[e]: element = self.view.get_element(e) if element is None and "_" in name: element = self.get_element(name.replace("_", " ")) diff --git a/pyproject.toml b/pyproject.toml index 44ded06..f717099 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bmt" -version = "1.1.2.post14.dev0+08be61e" +version = "1.2.1" description = "Biolink Model Toolkit: A Python API for working with the Biolink Model" authors = ["Sierra Taylor Moxon "] license = "BSD" diff --git a/tests/unit/test_toolkit.py b/tests/unit/test_toolkit.py index 2ecdfdf..3956c2a 100644 --- a/tests/unit/test_toolkit.py +++ b/tests/unit/test_toolkit.py @@ -130,6 +130,11 @@ def test_not_valid_edge(toolkit): def test_get_element_via_alias(toolkit): el = toolkit.get_element('definition') + pred_alias = toolkit.get_element("biolink:realized_in_response_to") + print(pred_alias) + ameliorates_aliase = toolkit.get_element("biolink:ameliorates") + assert ameliorates_aliase.name == "ameliorates condition" + assert pred_alias.name == "caused by" assert el.name == 'description' @@ -885,6 +890,9 @@ def test_descendants(toolkit): assert INTERACTS_WITH in toolkit.get_descendants(RELATED_TO) assert PHENOTYPIC_FEATURE in toolkit.get_descendants(NAMED_THING) assert RELATED_TO not in toolkit.get_descendants(NAMED_THING) + assert "ameliorates condition" in toolkit.get_descendants("biolink:ameliorates") + assert "biolink:ameliorates_condition" in toolkit.get_descendants("biolink:ameliorates", formatted=True) + with pytest.raises(ValueError): toolkit.get_descendants('biolink:invalid') assert "biolink:PhenotypicFeature" in toolkit.get_descendants(