From 4cc3e9eca5ce1534597cddb97d78138b89cf8217 Mon Sep 17 00:00:00 2001 From: sfluegel Date: Wed, 30 Jul 2025 09:45:55 +0200 Subject: [PATCH 1/2] use chebifier graph instead of chebai graph --- chebifier/prediction_models/chebi_lookup.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/chebifier/prediction_models/chebi_lookup.py b/chebifier/prediction_models/chebi_lookup.py index f314bf5..3870d08 100644 --- a/chebifier/prediction_models/chebi_lookup.py +++ b/chebifier/prediction_models/chebi_lookup.py @@ -6,7 +6,7 @@ import networkx as nx from rdkit import Chem import json - +from chebifier.utils import load_chebi_graph class ChEBILookupPredictor(BasePredictor): @@ -23,15 +23,7 @@ def __init__( or "ChEBI Lookup: If the SMILES is equivalent to a ChEBI entry, retrieve the classification of that entry." ) self.chebi_version = chebi_version - self.chebi_graph = kwargs.get("chebi_graph", None) - if self.chebi_graph is None: - from chebai.preprocessing.datasets.chebi import ChEBIOver50 - - self.chebi_dataset = ChEBIOver50(chebi_version=self.chebi_version) - self.chebi_dataset._download_required_data() - self.chebi_graph = self.chebi_dataset._extract_class_hierarchy( - os.path.join(self.chebi_dataset.raw_dir, "chebi.obo") - ) + self.chebi_graph = kwargs.get("chebi_graph", load_chebi_graph()) self.lookup_table = self.get_smiles_lookup() def get_smiles_lookup(self): From 75204a5a884a4f21e3766286e727561955a27e84 Mon Sep 17 00:00:00 2001 From: sfluegel Date: Wed, 30 Jul 2025 09:48:15 +0200 Subject: [PATCH 2/2] reformat with black --- chebifier/prediction_models/chebi_lookup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/chebifier/prediction_models/chebi_lookup.py b/chebifier/prediction_models/chebi_lookup.py index 3870d08..2f6a7b0 100644 --- a/chebifier/prediction_models/chebi_lookup.py +++ b/chebifier/prediction_models/chebi_lookup.py @@ -8,6 +8,7 @@ import json from chebifier.utils import load_chebi_graph + class ChEBILookupPredictor(BasePredictor): def __init__(