From 13900d04256fb192b33c33f9488ee1a6c0cddcac Mon Sep 17 00:00:00 2001 From: sfluegel Date: Fri, 24 Jul 2026 10:06:27 +0200 Subject: [PATCH 1/2] cast chebi ids to string to ensure that they can be compared to splits_df --- chebai/preprocessing/datasets/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/chebai/preprocessing/datasets/base.py b/chebai/preprocessing/datasets/base.py index 24655b0d..d5cd5653 100644 --- a/chebai/preprocessing/datasets/base.py +++ b/chebai/preprocessing/datasets/base.py @@ -1111,6 +1111,7 @@ def _retrieve_splits_from_csv(self) -> None: filename = self.processed_file_names_dict["data"] data = self.load_processed_data_from_file(filename) df_data = pd.DataFrame(data) + df_data["ident"] = df_data["ident"].astype(str) if self.apply_id_filter: print(f"Applying ID filter from {self.apply_id_filter}...") From b5bf1c5ee20a51dd3b323c369a7bc7cca8e82d1f Mon Sep 17 00:00:00 2001 From: sfluegel Date: Mon, 27 Jul 2026 11:32:35 +0200 Subject: [PATCH 2/2] more lenient 'STAR' handling --- chebai/preprocessing/datasets/chebi.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chebai/preprocessing/datasets/chebi.py b/chebai/preprocessing/datasets/chebi.py index a0af3ac8..d152f4f1 100644 --- a/chebai/preprocessing/datasets/chebi.py +++ b/chebai/preprocessing/datasets/chebi.py @@ -219,7 +219,14 @@ def _graph_to_raw_dataset(self, g: "nx.DiGraph") -> pd.DataFrame: sdf_path = os.path.join(self.raw_dir, self.raw_file_names_dict["sdf"]) mol_df = extract_molecules(sdf_path) - mol_df = mol_df[mol_df["STAR"] == self.subset[0]] if self.subset else mol_df + mol_df["star"] = ( + mol_df["STAR"] + if "STAR" in mol_df.columns + else mol_df["Star"] + if "Star" in mol_df.columns + else None + ) + mol_df = mol_df[mol_df["star"] == self.subset[0]] if self.subset else mol_df data, labels = build_labeled_dataset(g, mol_df, self.THRESHOLD) with open(os.path.join(self.classes_txt_file_path), "wt") as fout: @@ -818,7 +825,7 @@ class ChEBIOver100Fingerprints(ChEBIOverXFingerprints, ChEBIOver100): if __name__ == "__main__": dataset = ChEBIOver50( - chebi_version=251, + chebi_version=237, ) dataset.prepare_data() dataset.setup()