Skip to content

Commit c84d8a1

Browse files
committed
graph now uses string keys instead of ints
1 parent 4e3c356 commit c84d8a1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

chebifier/prediction_models/c3p_predictor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def predict_smiles_tuple(self, smiles_list: tuple[str]) -> list:
3939
chebi_id
4040
] = result.is_match
4141
if result.is_match and self.chebi_graph is not None:
42-
for parent in list(self.chebi_graph.predecessors(int(chebi_id))):
42+
for parent in list(self.chebi_graph.predecessors(chebi_id)):
4343
result_reformatted[smiles_list.index(result.input_smiles)][
4444
str(parent)
4545
] = 1

chebifier/prediction_models/chemlog_predictor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def predict_smiles_tuple(self, smiles_list: tuple[str]) -> list:
6363
sample_additions = dict()
6464
for cls in sample:
6565
if sample[cls] == 1:
66-
successors = list(self.chebi_graph.predecessors(int(cls)))
66+
successors = list(self.chebi_graph.predecessors(cls))
6767
if successors:
6868
for succ in successors:
6969
sample_additions[str(succ)] = 1
@@ -114,7 +114,7 @@ def predict_smiles(self, smiles: str) -> Optional[dict]:
114114
indirect_pos_labels = [
115115
str(pr)
116116
for label in pos_labels
117-
for pr in self.chebi_graph.predecessors(int(label))
117+
for pr in self.chebi_graph.predecessors(label)
118118
]
119119
pos_labels = list(set(pos_labels + indirect_pos_labels))
120120
return {

0 commit comments

Comments
 (0)