Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions chebifier/prediction_models/chebi_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import networkx as nx
from rdkit import Chem
import json
from chebifier.utils import load_chebi_graph


class ChEBILookupPredictor(BasePredictor):
Expand All @@ -23,15 +24,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):
Expand Down