Skip to content

Commit b355319

Browse files
authored
Merge pull request #14 from ChEB-AI/feature/remove_chebai_lookup_dependency
use chebifier graph instead of chebai graph
2 parents 955ab83 + 75204a5 commit b355319

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

chebifier/prediction_models/chebi_lookup.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import networkx as nx
77
from rdkit import Chem
88
import json
9+
from chebifier.utils import load_chebi_graph
910

1011

1112
class ChEBILookupPredictor(BasePredictor):
@@ -23,15 +24,7 @@ def __init__(
2324
or "ChEBI Lookup: If the SMILES is equivalent to a ChEBI entry, retrieve the classification of that entry."
2425
)
2526
self.chebi_version = chebi_version
26-
self.chebi_graph = kwargs.get("chebi_graph", None)
27-
if self.chebi_graph is None:
28-
from chebai.preprocessing.datasets.chebi import ChEBIOver50
29-
30-
self.chebi_dataset = ChEBIOver50(chebi_version=self.chebi_version)
31-
self.chebi_dataset._download_required_data()
32-
self.chebi_graph = self.chebi_dataset._extract_class_hierarchy(
33-
os.path.join(self.chebi_dataset.raw_dir, "chebi.obo")
34-
)
27+
self.chebi_graph = kwargs.get("chebi_graph", load_chebi_graph())
3528
self.lookup_table = self.get_smiles_lookup()
3629

3730
def get_smiles_lookup(self):

0 commit comments

Comments
 (0)