Skip to content

Commit 9307c56

Browse files
committed
Merge branch 'dev' into fix/model-specific-package
2 parents 1bd6a0b + b355319 commit 9307c56

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

chebifier/prediction_models/chebi_lookup.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,15 @@ def __init__(
1616
chebi_version: int = 241,
1717
**kwargs,
1818
):
19+
from chebifier.utils import load_chebi_graph
20+
1921
super().__init__(model_name, **kwargs)
2022
self._description = (
2123
description
2224
or "ChEBI Lookup: If the SMILES is equivalent to a ChEBI entry, retrieve the classification of that entry."
2325
)
2426
self.chebi_version = chebi_version
25-
self.chebi_graph = kwargs.get("chebi_graph", None)
26-
if self.chebi_graph is None:
27-
from chebai.preprocessing.datasets.chebi import ChEBIOver50
28-
29-
self.chebi_dataset = ChEBIOver50(chebi_version=self.chebi_version)
30-
self.chebi_dataset._download_required_data()
31-
self.chebi_graph = self.chebi_dataset._extract_class_hierarchy(
32-
os.path.join(self.chebi_dataset.raw_dir, "chebi.obo")
33-
)
27+
self.chebi_graph = kwargs.get("chebi_graph", load_chebi_graph())
3428
self.lookup_table = self.get_smiles_lookup()
3529

3630
def get_smiles_lookup(self):

0 commit comments

Comments
 (0)