From da98a29af20fe624e9ede458a99cc5434fef63f4 Mon Sep 17 00:00:00 2001 From: nanglo123 Date: Fri, 20 Sep 2024 09:49:39 -0400 Subject: [PATCH] Add fallback option to download and convert ncbitaxon obo graph --- mira/dkg/construct.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mira/dkg/construct.py b/mira/dkg/construct.py index 4b97ea91..322f6c53 100644 --- a/mira/dkg/construct.py +++ b/mira/dkg/construct.py @@ -61,6 +61,7 @@ from mira.dkg.resources.geonames import get_geonames_terms from mira.dkg.resources.extract_eiffel_ontology import get_eiffel_ontology_terms from mira.dkg.resources.uat import get_uat +from mira.dkg.generate_obo_graphs import download_convert_ncbitaxon_obo_to_graph MODULE = pystow.module("mira") DEMO_MODULE = MODULE.module("demo", "import") @@ -462,7 +463,8 @@ def extract_ontology_subtree(curie: str, add_subtree: bool = False): cached_relabeled_obo_graph_path = prefix_directory_join(resource_prefix, name="relabeled_obo_graph.pkl", version=version) - + if not cached_relabeled_obo_graph_path.exists(): + download_convert_ncbitaxon_obo_to_graph() with open(cached_relabeled_obo_graph_path,'rb') as relabeled_graph_file: relabeled_graph = pickle.load(relabeled_graph_file) else: