Datasets:
File size: 4,126 Bytes
8df5ac9 dc74a22 8df5ac9 9539b85 aa4dde5 9539b85 1fb71c5 8df5ac9 809aed4 8df5ac9 809aed4 8df5ac9 809aed4 8df5ac9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | ---
license: cc-by-4.0
language:
- en
tags:
- chemistry
configs:
- config_name: k3
default: true
data_files:
- "k3/k3_split.parquet"
- config_name: k4
data_files:
- "k4/k4_split.parquet"
- config_name: k4_2ar
data_files:
- "k4_2ar/k4_2ar_split.parquet"
- config_name: k5
data_files:
- "k5/k5_split.parquet"
- config_name: k3_labels
data_files:
- "k3/k3_labels.parquet"
- config_name: k4_labels
data_files:
- "k4/k4_labels.parquet"
- config_name: k4_2ar_labels
data_files:
- "k4_2ar/k4_2ar_labels.parquet"
- config_name: k5_labels
data_files:
- "k5/k5_labels.parquet"
---
# 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.parquet
```
## Downloading the Data
Datasets can be downloaded **directly from Hugging Face** using the Python
script below.
### Requirements
- Python β₯ 3.8
- `requests`
- Environment variable `PHARM_PROJECT_ROOT` pointing to the project root
```bash
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 k4
```
Files 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 |