From 457990845988d032566312aa9eac9da6e8b46371 Mon Sep 17 00:00:00 2001 From: Evan Morris Date: Fri, 8 Mar 2024 12:01:19 -0500 Subject: [PATCH] adding the ability to set a specific biolink model version with an env var --- README.md | 6 ++++++ reasoner_transpiler/matching.py | 8 +++++++- setup.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a0d8f47..a5618b2 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,9 @@ qgraph = { cypher = get_query(qgraph) ``` + +## Biolink Model +This package uses the Biolink Model Toolkit to access the Biolink Model. Optionally, choose a specific version of the Biolink Model with the environment variable BL_VERSION. Otherwise, the latest version used by the Biolink Model Toolkit will be used. +```commandline +export BL_VERSION=4.1.6 +``` diff --git a/reasoner_transpiler/matching.py b/reasoner_transpiler/matching.py index e5f4cf9..93f083f 100644 --- a/reasoner_transpiler/matching.py +++ b/reasoner_transpiler/matching.py @@ -1,4 +1,5 @@ """MATCHing tools.""" +import os from typing import Dict, List from bmt import Toolkit @@ -7,7 +8,12 @@ from .nesting import Query from .util import ensure_list, snake_case, space_case, pascal_case -bmt = Toolkit() + +BIOLINK_MODEL_VERSION = os.environ.get('BL_VERSION', '4.1.6') +BIOLINK_MODEL_SCHEMA_URL = f"https://raw.githubusercontent.com/biolink/biolink-model/v{BIOLINK_MODEL_VERSION}/biolink-model.yaml" +PREDICATE_MAP_URL = f"https://raw.githubusercontent.com/biolink/biolink-model/v{BIOLINK_MODEL_VERSION}/predicate_mapping.yaml" + +bmt = Toolkit(schema=BIOLINK_MODEL_SCHEMA_URL, predicate_map=PREDICATE_MAP_URL) ALL_BIOLINK_ENUMS = bmt.view.all_enums().keys() def cypher_prop_string(value): diff --git a/setup.py b/setup.py index 733661f..0268bf7 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name="reasoner-transpiler", - version="2.0.6", + version="2.0.7", author="Patrick Wang", author_email="patrick@covar.com", maintainer="Yaphet Kebede",