Skip to content

Commit 42e569b

Browse files
committed
fix 3-star processing
1 parent f90265e commit 42e569b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

chebai/preprocessing/datasets/chebi.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,12 @@ def _extract_class_hierarchy(self, data_path: str) -> "nx.DiGraph":
253253
):
254254
term_dict = term_callback(term_doc)
255255
if term_dict and (
256-
not self.subset or term_dict["subset"] == self.subset
256+
not self.subset
257+
or (
258+
"subset" in term_dict
259+
and term_dict["subset"] is not None
260+
and term_dict["subset"][0] == self.subset[0]
261+
) # match 3:STAR to 3_STAR, 3star, 3_star, etc.
257262
):
258263
elements.append(term_dict)
259264

@@ -1068,6 +1073,6 @@ def term_callback(doc: "fastobo.term.TermFrame") -> Union[Dict, bool]:
10681073

10691074

10701075
if __name__ == "__main__":
1071-
dataset = ChEBIOver50(chebi_version=246)
1072-
# dataset.prepare_data()
1076+
dataset = ChEBIOver50(chebi_version=248, subset="3_STAR")
1077+
dataset.prepare_data()
10731078
dataset.setup()

0 commit comments

Comments
 (0)