klimczakjakubdev/pharmaco-explainer
Pharmaco-Explainer Datasets This repository contains datasets used in the Pharmaco-Explainer project. They are shared separately on Hugging Face and are used by the training and experimentation code hosted on GitHub: π Training code and scripts:https://github.com/AdamSulek/pharmaco-explainer/ Available Datasets The following datasets are available: k3: 3-element pharmacophore k4_2ar: 4-element pharmacophore with two aromatic features k4: 4-element pharmacophoreβ¦ See the full description on the dataset page: https://huggingface.co/datasets/klimczakjakubdev/pharmaco-explainer.
Pharmaco-Explainer Datasets
This repository contains datasets used in the Pharmaco-Explainer project. They are shared separately on Hugging Face and are used by the training and experimentation code hosted on GitHub:
π Training code and scripts: https://github.com/AdamSulek/pharmaco-explainer/
Available Datasets
The following datasets are available:
- k3: 3-element pharmacophore
- k4_2ar: 4-element pharmacophore with two aromatic features
- k4: 4-element pharmacophore
- k5 5-element pharmacophore
Each dataset consists of three files:
<dataset>.parquetβ main feature data<dataset>_split.parquetβ predefined train/val/test split<dataset>_labels.parquetβ labels
Repository structure:
k3/
βββ k3.parquet
βββ k3_split.parquet
βββ k3_labels.parquet
k4_2ar/
βββ k4_2ar.parquet
βββ k4_2ar_split.parquet
βββ k4_2ar_labels.parquet
k4/
βββ k4.parquet
βββ k4_split.parquet
βββ k4_labels.parquet
k5/
βββ k5.parquet
βββ k5_split.parquet
βββ k5_labels.parquetDownloading the Data
Datasets can be downloaded directly from Hugging Face using the Python script below.
Requirements
- Python β₯ 3.8
requests- Environment variable
PHARM_PROJECT_ROOTpointing to the project root
import argparse
from pathlib import Path
import requests
import os
def project_path(*parts):
root = os.environ.get("PHARM_PROJECT_ROOT")
if root is None:
raise RuntimeError(
"Environment variable PHARM_PROJECT_ROOT is not set.\n"
"Run:\n"
" export PHARM_PROJECT_ROOT=/path/to/project"
)
return os.path.join(root, *parts)
def download_file(url, dest_path: Path):
dest_path.parent.mkdir(parents=True, exist_ok=True)
if dest_path.exists():
print(f"File already exists, skipping: {dest_path}")
return
print(f"Downloading {url} -> {dest_path}")
r = requests.get(url, stream=True)
r.raise_for_status()
with open(dest_path, "wb") as f:
for chunk in r.iter_content(chunk_size=1024 * 1024):
if chunk:
f.write(chunk)
def download_dataset(dataset_name):
base_url = (
f"https://huggingface.co/datasets/"
f"klimczakjakubdev/pharmaco-explainer/resolve/main/{dataset_name}/"
)
files = [
f"{dataset_name}.parquet",
f"{dataset_name}_split.parquet",
f"{dataset_name}_labels.parquet",
]
dest_dir = Path(project_path("data", dataset_name))
for file_name in files:
url = base_url + file_name
dest_path = dest_dir / file_name
download_file(url, dest_path)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--dataset",
type=str,
default="k3",
choices=["k3", "k4", "k4_2ar", "k5"],
help="Which dataset to download"
)
args = parser.parse_args()
download_dataset(args.dataset)Example Usage
python download_dataset.py --dataset k4Files will be downloaded to:
$PHARM_PROJECT_ROOT/data/k4/Related Repository
These datasets are used by the main Pharmaco-Explainer codebase:
π https://github.com/AdamSulek/pharmaco-explainer/
That repository contains:
- model training code
- experiment configurations
- preprocessing scripts
- evaluation and explainability pipelines
