Initial upload: RNA-small molecule interaction prediction dataset with three evaluation scenarios
Browse files- .gitattributes +2 -0
- README.md +81 -0
- compound_ood/DATASET_REPORT.md +47 -0
- compound_ood/test_text.csv +0 -0
- compound_ood/train_text.csv +3 -0
- compound_ood/val_text.csv +0 -0
- full_ood/DATASET_REPORT.md +47 -0
- full_ood/test_text.csv +0 -0
- full_ood/train_text.csv +0 -0
- full_ood/val_text.csv +0 -0
- in_distribution/test_text.csv +0 -0
- in_distribution/train_text.csv +3 -0
- in_distribution/val_text.csv +0 -0
- scripts/create_disjoint_splits.py +472 -0
.gitattributes
CHANGED
|
@@ -57,3 +57,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
compound_ood/train_text.csv filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
in_distribution/train_text.csv filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DrugRNA Dataset
|
| 2 |
+
|
| 3 |
+
This repository contains the RNA-small molecule interaction prediction dataset used in the paper "LLM Agents Enable RNA–Small Molecule Interaction Prediction at Performance Comparable to Human-Designed Models".
|
| 4 |
+
|
| 5 |
+
## Dataset Description
|
| 6 |
+
|
| 7 |
+
The dataset is derived from the RNAInter repository and contains experimentally validated RNA-compound interactions. It includes 45,049 RNA–compound pairs spanning 3,258 unique RNAs and 345 unique compounds, with a 1:4 positive/negative ratio.
|
| 8 |
+
|
| 9 |
+
## Data Splits
|
| 10 |
+
|
| 11 |
+
The dataset is organized into three evaluation scenarios:
|
| 12 |
+
|
| 13 |
+
### 1. In-Distribution Split (`in_distribution/`)
|
| 14 |
+
- **Purpose**: Standard 80/10/10 train/validation/test split for head-to-head performance comparison
|
| 15 |
+
- **Characteristics**: Complete entity overlap, testing interpolation within known molecular space
|
| 16 |
+
- **Files**:
|
| 17 |
+
- `train_text.csv` (36,040 samples, 20.0% positive)
|
| 18 |
+
- `val_text.csv` (4,504 samples, 19.8% positive)
|
| 19 |
+
- `test_text.csv` (4,505 samples, 20.2% positive)
|
| 20 |
+
- **Total**: 45,049 samples with 3,258 unique RNAs and 345 unique compounds
|
| 21 |
+
|
| 22 |
+
### 2. Full Out-of-Domain Split (`full_ood/`)
|
| 23 |
+
- **Purpose**: Cold-start prediction with entirely novel entities
|
| 24 |
+
- **Characteristics**: Zero overlap for both RNAs and compounds between training and test sets
|
| 25 |
+
- **Files**:
|
| 26 |
+
- `train_text.csv` (21,794 samples, 18.4% positive)
|
| 27 |
+
- `val_text.csv` (1,081 samples, 22.1% positive)
|
| 28 |
+
- `test_text.csv` (1,020 samples, 24.2% positive)
|
| 29 |
+
- `DATASET_REPORT.md` (detailed statistics and construction methodology)
|
| 30 |
+
- **Total**: 23,895 samples with 3,142 unique RNAs and 363 unique compounds
|
| 31 |
+
|
| 32 |
+
### 3. Compound Out-of-Domain Split (`compound_ood/`)
|
| 33 |
+
- **Purpose**: Virtual screening of novel compounds against known RNA targets
|
| 34 |
+
- **Characteristics**: Zero compound overlap, complete RNA reuse (86% of training RNAs appear in test)
|
| 35 |
+
- **Files**:
|
| 36 |
+
- `train_text.csv` (31,576 samples, 21.0% positive)
|
| 37 |
+
- `val_text.csv` (6,694 samples, 20.1% positive)
|
| 38 |
+
- `test_text.csv` (6,779 samples, 15.2% positive)
|
| 39 |
+
- `DATASET_REPORT.md` (detailed statistics and construction methodology)
|
| 40 |
+
- **Total**: 45,049 samples with 3,258 unique RNAs and 345 unique compounds
|
| 41 |
+
|
| 42 |
+
## Data Format
|
| 43 |
+
|
| 44 |
+
Each CSV file contains the following columns:
|
| 45 |
+
- `rna_id`: RNA identifier
|
| 46 |
+
- `compound_id`: Compound identifier (PubChem CID)
|
| 47 |
+
- `rna_sequence`: RNA nucleotide sequence (A, U, G, C)
|
| 48 |
+
- `compound_smiles`: SMILES string representation of the compound
|
| 49 |
+
- `label`: Binary interaction label (1 = interaction, 0 = no interaction)
|
| 50 |
+
|
| 51 |
+
## Scripts
|
| 52 |
+
|
| 53 |
+
The `scripts/` folder contains:
|
| 54 |
+
- `create_disjoint_splits.py`: Script used to generate the out-of-domain splits with strict entity disjointness
|
| 55 |
+
|
| 56 |
+
## Data Sources
|
| 57 |
+
|
| 58 |
+
- **RNAs**: Mapped from NCBI, Ensembl, miRBase, and circBase
|
| 59 |
+
- **Compounds**: Mapped from PubChem
|
| 60 |
+
- **Interactions**: Curated from RNAInter repository with experimental evidence
|
| 61 |
+
|
| 62 |
+
## Citation
|
| 63 |
+
|
| 64 |
+
If you use this dataset in your research, please cite:
|
| 65 |
+
|
| 66 |
+
```bibtex
|
| 67 |
+
@article{drugrna2025,
|
| 68 |
+
title={LLM Agents Enable RNA–Small Molecule Interaction Prediction at Performance Comparable to Human-Designed Models},
|
| 69 |
+
author={...},
|
| 70 |
+
journal={...},
|
| 71 |
+
year={2025}
|
| 72 |
+
}
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## License
|
| 76 |
+
|
| 77 |
+
This dataset is provided for research purposes. Please refer to the original data sources for specific licensing information.
|
| 78 |
+
|
| 79 |
+
## Contact
|
| 80 |
+
|
| 81 |
+
For questions or issues, please open an issue on the GitHub repository or contact the authors.
|
compound_ood/DATASET_REPORT.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# rna_inter_disjoint_compound Dataset Report
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
Disjoint splits created from rna_inter (public RNA-compound interaction dataset).
|
| 5 |
+
|
| 6 |
+
## Split Statistics
|
| 7 |
+
|
| 8 |
+
### Sample Counts
|
| 9 |
+
- Train: 31,576 samples (21.0% positive)
|
| 10 |
+
- Val: 6,694 samples (20.1% positive)
|
| 11 |
+
- Test: 6,779 samples (15.2% positive)
|
| 12 |
+
- Total: 45,049 samples
|
| 13 |
+
|
| 14 |
+
### Unique Entities
|
| 15 |
+
|
| 16 |
+
#### Compounds
|
| 17 |
+
- Train: 238
|
| 18 |
+
- Val: 52
|
| 19 |
+
- Test: 55
|
| 20 |
+
|
| 21 |
+
#### RNAs
|
| 22 |
+
- Train: 2,784
|
| 23 |
+
- Val: 2,390
|
| 24 |
+
- Test: 2,403
|
| 25 |
+
|
| 26 |
+
## Disjointness Properties
|
| 27 |
+
|
| 28 |
+
### Compound Disjointness
|
| 29 |
+
- Train-Val compound overlap: 0
|
| 30 |
+
- Train-Test compound overlap: 0
|
| 31 |
+
- Val-Test compound overlap: 0
|
| 32 |
+
|
| 33 |
+
### RNA Disjointness
|
| 34 |
+
- Train-Val RNA overlap: 2390
|
| 35 |
+
- Train-Test RNA overlap: 2403
|
| 36 |
+
- Val-Test RNA overlap: 2065
|
| 37 |
+
|
| 38 |
+
## Output Format
|
| 39 |
+
Same as rna_inter:
|
| 40 |
+
- Columns: RNA_ID, Compound_ID, RNA_seq, SMILES, text, label
|
| 41 |
+
- Files: train_text.csv, val_text.csv, test_text.csv
|
| 42 |
+
|
| 43 |
+
## Use Case
|
| 44 |
+
This split tests the model's ability to generalize to:
|
| 45 |
+
- New RNAs
|
| 46 |
+
|
| 47 |
+
Date: 2025-10-27 16:16:05
|
compound_ood/test_text.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
compound_ood/train_text.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:35385af14685d07a11b74857c667e77129d0e66337d0d96eb3a66cdcdd4360b6
|
| 3 |
+
size 12787901
|
compound_ood/val_text.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
full_ood/DATASET_REPORT.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# rna_inter_disjoint Dataset Report
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
Disjoint splits created from rna_inter (public RNA-compound interaction dataset).
|
| 5 |
+
|
| 6 |
+
## Split Statistics
|
| 7 |
+
|
| 8 |
+
### Sample Counts
|
| 9 |
+
- Train: 21,794 samples (18.4% positive)
|
| 10 |
+
- Val: 1,081 samples (22.1% positive)
|
| 11 |
+
- Test: 1,020 samples (24.2% positive)
|
| 12 |
+
- Total: 23,895 samples
|
| 13 |
+
|
| 14 |
+
### Unique Entities
|
| 15 |
+
|
| 16 |
+
#### Compounds
|
| 17 |
+
- Train: 241
|
| 18 |
+
- Val: 51
|
| 19 |
+
- Test: 53
|
| 20 |
+
|
| 21 |
+
#### RNAs
|
| 22 |
+
- Train: 1,948
|
| 23 |
+
- Val: 368
|
| 24 |
+
- Test: 371
|
| 25 |
+
|
| 26 |
+
## Disjointness Properties
|
| 27 |
+
|
| 28 |
+
### Compound Disjointness
|
| 29 |
+
- Train-Val compound overlap: 0
|
| 30 |
+
- Train-Test compound overlap: 0
|
| 31 |
+
- Val-Test compound overlap: 0
|
| 32 |
+
|
| 33 |
+
### RNA Disjointness
|
| 34 |
+
- Train-Val RNA overlap: 0
|
| 35 |
+
- Train-Test RNA overlap: 0
|
| 36 |
+
- Val-Test RNA overlap: 0
|
| 37 |
+
|
| 38 |
+
## Output Format
|
| 39 |
+
Same as rna_inter:
|
| 40 |
+
- Columns: RNA_ID, Compound_ID, RNA_seq, SMILES, text, label
|
| 41 |
+
- Files: train_text.csv, val_text.csv, test_text.csv
|
| 42 |
+
|
| 43 |
+
## Use Case
|
| 44 |
+
This split tests the model's ability to generalize to:
|
| 45 |
+
- New RNAs
|
| 46 |
+
|
| 47 |
+
Date: 2025-10-27 16:16:04
|
full_ood/test_text.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
full_ood/train_text.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
full_ood/val_text.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
in_distribution/test_text.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
in_distribution/train_text.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec89af53e0d5be4d4bcb4c09b976ce84249e3c1098ee27f4e382ebf6875dc0b4
|
| 3 |
+
size 14296166
|
in_distribution/val_text.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
scripts/create_disjoint_splits.py
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Create disjoint splits from drug_rna_cds_sampled_11 dataset.
|
| 4 |
+
|
| 5 |
+
Creates three datasets:
|
| 6 |
+
1. drug_rna_cds_disjoint (fully disjoint if possible)
|
| 7 |
+
2. drug_rna_cds_disjoint_rna (RNA-disjoint)
|
| 8 |
+
3. drug_rna_cds_disjoint_compound (compound-disjoint)
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import pandas as pd
|
| 12 |
+
import numpy as np
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
from collections import defaultdict
|
| 15 |
+
import argparse
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def analyze_disjoint_feasibility(df):
|
| 19 |
+
"""Analyze if fully disjoint split is feasible."""
|
| 20 |
+
print("=" * 80)
|
| 21 |
+
print("ANALYZING DISJOINT SPLIT FEASIBILITY")
|
| 22 |
+
print("=" * 80)
|
| 23 |
+
|
| 24 |
+
n_compounds = df['SMILES'].nunique()
|
| 25 |
+
n_rnas = df['RNA_seq'].nunique()
|
| 26 |
+
n_samples = len(df)
|
| 27 |
+
|
| 28 |
+
print(f"\nDataset statistics:")
|
| 29 |
+
print(f" Total samples: {n_samples:,}")
|
| 30 |
+
print(f" Unique compounds: {n_compounds:,}")
|
| 31 |
+
print(f" Unique RNAs: {n_rnas:,}")
|
| 32 |
+
|
| 33 |
+
# Analyze compound-RNA pairs
|
| 34 |
+
pairs = df.groupby(['SMILES', 'RNA_seq']).size().reset_index(name='count')
|
| 35 |
+
print(f" Unique (compound, RNA) pairs: {len(pairs):,}")
|
| 36 |
+
|
| 37 |
+
# Check samples per entity
|
| 38 |
+
samples_per_compound = df.groupby('SMILES').size()
|
| 39 |
+
samples_per_rna = df.groupby('RNA_seq').size()
|
| 40 |
+
|
| 41 |
+
print(f"\n Samples per compound: mean={samples_per_compound.mean():.1f}, median={samples_per_compound.median():.1f}")
|
| 42 |
+
print(f" Samples per RNA: mean={samples_per_rna.mean():.1f}, median={samples_per_rna.median():.1f}")
|
| 43 |
+
|
| 44 |
+
# Estimate fully disjoint feasibility
|
| 45 |
+
# For fully disjoint: need non-overlapping sets of (compound, RNA) pairs
|
| 46 |
+
# This is only possible if we can partition compounds and RNAs
|
| 47 |
+
|
| 48 |
+
# Simple heuristic: check if we have enough samples
|
| 49 |
+
min_samples_needed = int(0.15 * n_samples) # For test set (15%)
|
| 50 |
+
|
| 51 |
+
print(f"\n Minimum samples needed for test (15%): {min_samples_needed:,}")
|
| 52 |
+
|
| 53 |
+
# Check if we can allocate compounds/RNAs
|
| 54 |
+
n_compounds_test = int(0.15 * n_compounds)
|
| 55 |
+
n_rnas_test = int(0.15 * n_rnas)
|
| 56 |
+
|
| 57 |
+
print(f" If we allocate 15% of compounds: {n_compounds_test} compounds")
|
| 58 |
+
print(f" If we allocate 15% of RNAs: {n_rnas_test} RNAs")
|
| 59 |
+
print(f" Max possible samples (all pairs): {n_compounds_test * n_rnas_test:,}")
|
| 60 |
+
|
| 61 |
+
# Check actual connectivity
|
| 62 |
+
compound_to_rnas = df.groupby('SMILES')['RNA_seq'].apply(set).to_dict()
|
| 63 |
+
rna_to_compounds = df.groupby('RNA_seq')['SMILES'].apply(set).to_dict()
|
| 64 |
+
|
| 65 |
+
# Calculate how connected the graph is
|
| 66 |
+
avg_rnas_per_compound = df.groupby('SMILES')['RNA_seq'].nunique().mean()
|
| 67 |
+
avg_compounds_per_rna = df.groupby('RNA_seq')['SMILES'].nunique().mean()
|
| 68 |
+
|
| 69 |
+
print(f"\n Connectivity:")
|
| 70 |
+
print(f" Avg RNAs per compound: {avg_rnas_per_compound:.1f}")
|
| 71 |
+
print(f" Avg compounds per RNA: {avg_compounds_per_rna:.1f}")
|
| 72 |
+
|
| 73 |
+
# Determine feasibility
|
| 74 |
+
fully_disjoint_feasible = (n_compounds_test * n_rnas_test >= min_samples_needed)
|
| 75 |
+
|
| 76 |
+
print(f"\n Fully disjoint split feasible: {'YES' if fully_disjoint_feasible else 'NO'}")
|
| 77 |
+
|
| 78 |
+
return fully_disjoint_feasible
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def create_fully_disjoint_split(df, train_ratio=0.7, val_ratio=0.15, seed=42):
|
| 82 |
+
"""Create fully disjoint split (compounds AND RNAs don't overlap)."""
|
| 83 |
+
print("\n" + "=" * 80)
|
| 84 |
+
print("CREATING FULLY DISJOINT SPLIT")
|
| 85 |
+
print("=" * 80)
|
| 86 |
+
|
| 87 |
+
np.random.seed(seed)
|
| 88 |
+
|
| 89 |
+
# Get unique entities
|
| 90 |
+
compounds = df['SMILES'].unique()
|
| 91 |
+
rnas = df['RNA_seq'].unique()
|
| 92 |
+
|
| 93 |
+
# Shuffle
|
| 94 |
+
np.random.shuffle(compounds)
|
| 95 |
+
np.random.shuffle(rnas)
|
| 96 |
+
|
| 97 |
+
# Split compounds
|
| 98 |
+
n_compounds = len(compounds)
|
| 99 |
+
n_train_comp = int(train_ratio * n_compounds)
|
| 100 |
+
n_val_comp = int(val_ratio * n_compounds)
|
| 101 |
+
|
| 102 |
+
train_compounds = set(compounds[:n_train_comp])
|
| 103 |
+
val_compounds = set(compounds[n_train_comp:n_train_comp + n_val_comp])
|
| 104 |
+
test_compounds = set(compounds[n_train_comp + n_val_comp:])
|
| 105 |
+
|
| 106 |
+
# Split RNAs
|
| 107 |
+
n_rnas = len(rnas)
|
| 108 |
+
n_train_rna = int(train_ratio * n_rnas)
|
| 109 |
+
n_val_rna = int(val_ratio * n_rnas)
|
| 110 |
+
|
| 111 |
+
train_rnas = set(rnas[:n_train_rna])
|
| 112 |
+
val_rnas = set(rnas[n_train_rna:n_train_rna + n_val_rna])
|
| 113 |
+
test_rnas = set(rnas[n_train_rna + n_val_rna:])
|
| 114 |
+
|
| 115 |
+
# Assign samples based on BOTH compound and RNA membership
|
| 116 |
+
train_df = df[(df['SMILES'].isin(train_compounds)) & (df['RNA_seq'].isin(train_rnas))].copy()
|
| 117 |
+
val_df = df[(df['SMILES'].isin(val_compounds)) & (df['RNA_seq'].isin(val_rnas))].copy()
|
| 118 |
+
test_df = df[(df['SMILES'].isin(test_compounds)) & (df['RNA_seq'].isin(test_rnas))].copy()
|
| 119 |
+
|
| 120 |
+
print(f"\n Allocated:")
|
| 121 |
+
print(f" Train: {len(train_compounds)} compounds, {len(train_rnas)} RNAs → {len(train_df)} samples")
|
| 122 |
+
print(f" Val: {len(val_compounds)} compounds, {len(val_rnas)} RNAs → {len(val_df)} samples")
|
| 123 |
+
print(f" Test: {len(test_compounds)} compounds, {len(test_rnas)} RNAs → {len(test_df)} samples")
|
| 124 |
+
|
| 125 |
+
total_samples = len(train_df) + len(val_df) + len(test_df)
|
| 126 |
+
print(f"\n Total samples retained: {total_samples:,} / {len(df):,} ({100*total_samples/len(df):.1f}%)")
|
| 127 |
+
|
| 128 |
+
if total_samples < 0.5 * len(df):
|
| 129 |
+
print(f"\n ⚠️ Warning: Lost {100*(1-total_samples/len(df)):.1f}% of samples")
|
| 130 |
+
print(f" Fully disjoint split may not be practical for this dataset")
|
| 131 |
+
return None
|
| 132 |
+
|
| 133 |
+
return train_df, val_df, test_df
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def create_rna_disjoint_split(df, train_ratio=0.7, val_ratio=0.15, seed=42):
|
| 137 |
+
"""Create RNA-disjoint split (RNAs don't overlap across splits)."""
|
| 138 |
+
print("\n" + "=" * 80)
|
| 139 |
+
print("CREATING RNA-DISJOINT SPLIT (Target: 70:15:15)")
|
| 140 |
+
print("=" * 80)
|
| 141 |
+
|
| 142 |
+
np.random.seed(seed)
|
| 143 |
+
|
| 144 |
+
# Get RNAs with their sample counts
|
| 145 |
+
rna_counts = df.groupby('RNA_seq').size().reset_index(name='count')
|
| 146 |
+
rna_counts = rna_counts.sample(frac=1, random_state=seed).reset_index(drop=True) # Shuffle
|
| 147 |
+
|
| 148 |
+
# Target sample counts
|
| 149 |
+
total_samples = len(df)
|
| 150 |
+
target_train = int(train_ratio * total_samples)
|
| 151 |
+
target_val = int(val_ratio * total_samples)
|
| 152 |
+
target_test = total_samples - target_train - target_val
|
| 153 |
+
|
| 154 |
+
print(f"\n Target sample distribution:")
|
| 155 |
+
print(f" Train: {target_train:,} ({train_ratio*100:.0f}%)")
|
| 156 |
+
print(f" Val: {target_val:,} ({val_ratio*100:.0f}%)")
|
| 157 |
+
print(f" Test: {target_test:,} ({(1-train_ratio-val_ratio)*100:.0f}%)")
|
| 158 |
+
|
| 159 |
+
# Greedy assignment: assign RNAs to splits to match target ratios
|
| 160 |
+
train_rnas = []
|
| 161 |
+
val_rnas = []
|
| 162 |
+
test_rnas = []
|
| 163 |
+
|
| 164 |
+
train_count = 0
|
| 165 |
+
val_count = 0
|
| 166 |
+
test_count = 0
|
| 167 |
+
|
| 168 |
+
for _, row in rna_counts.iterrows():
|
| 169 |
+
rna = row['RNA_seq']
|
| 170 |
+
count = row['count']
|
| 171 |
+
|
| 172 |
+
# Assign to the split that needs samples most
|
| 173 |
+
train_deficit = target_train - train_count
|
| 174 |
+
val_deficit = target_val - val_count
|
| 175 |
+
test_deficit = target_test - test_count
|
| 176 |
+
|
| 177 |
+
if train_deficit >= val_deficit and train_deficit >= test_deficit:
|
| 178 |
+
train_rnas.append(rna)
|
| 179 |
+
train_count += count
|
| 180 |
+
elif val_deficit >= test_deficit:
|
| 181 |
+
val_rnas.append(rna)
|
| 182 |
+
val_count += count
|
| 183 |
+
else:
|
| 184 |
+
test_rnas.append(rna)
|
| 185 |
+
test_count += count
|
| 186 |
+
|
| 187 |
+
train_rnas = set(train_rnas)
|
| 188 |
+
val_rnas = set(val_rnas)
|
| 189 |
+
test_rnas = set(test_rnas)
|
| 190 |
+
|
| 191 |
+
# Assign samples based on RNA
|
| 192 |
+
train_df = df[df['RNA_seq'].isin(train_rnas)].copy()
|
| 193 |
+
val_df = df[df['RNA_seq'].isin(val_rnas)].copy()
|
| 194 |
+
test_df = df[df['RNA_seq'].isin(test_rnas)].copy()
|
| 195 |
+
|
| 196 |
+
print(f"\n Split RNAs:")
|
| 197 |
+
print(f" Train: {len(train_rnas)} RNAs ({len(train_df):,} samples, {100*len(train_df)/len(df):.1f}%)")
|
| 198 |
+
print(f" Val: {len(val_rnas)} RNAs ({len(val_df):,} samples, {100*len(val_df)/len(df):.1f}%)")
|
| 199 |
+
print(f" Test: {len(test_rnas)} RNAs ({len(test_df):,} samples, {100*len(test_df)/len(df):.1f}%)")
|
| 200 |
+
|
| 201 |
+
# Verify disjointness
|
| 202 |
+
assert len(train_rnas & val_rnas) == 0, "Train and val RNAs overlap!"
|
| 203 |
+
assert len(train_rnas & test_rnas) == 0, "Train and test RNAs overlap!"
|
| 204 |
+
assert len(val_rnas & test_rnas) == 0, "Val and test RNAs overlap!"
|
| 205 |
+
|
| 206 |
+
print(f"\n ✓ RNA-disjoint verified: no RNA overlap across splits")
|
| 207 |
+
|
| 208 |
+
# Check compound overlap (expected)
|
| 209 |
+
train_compounds = set(train_df['SMILES'].unique())
|
| 210 |
+
val_compounds = set(val_df['SMILES'].unique())
|
| 211 |
+
test_compounds = set(test_df['SMILES'].unique())
|
| 212 |
+
|
| 213 |
+
overlap_train_val = len(train_compounds & val_compounds)
|
| 214 |
+
overlap_train_test = len(train_compounds & test_compounds)
|
| 215 |
+
|
| 216 |
+
print(f"\n Compound overlap (expected):")
|
| 217 |
+
print(f" Train-Val: {overlap_train_val} compounds")
|
| 218 |
+
print(f" Train-Test: {overlap_train_test} compounds")
|
| 219 |
+
|
| 220 |
+
return train_df, val_df, test_df
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
def create_compound_disjoint_split(df, train_ratio=0.7, val_ratio=0.15, seed=42):
|
| 224 |
+
"""Create compound-disjoint split (compounds don't overlap across splits)."""
|
| 225 |
+
print("\n" + "=" * 80)
|
| 226 |
+
print("CREATING COMPOUND-DISJOINT SPLIT (Target: 70:15:15)")
|
| 227 |
+
print("=" * 80)
|
| 228 |
+
|
| 229 |
+
np.random.seed(seed)
|
| 230 |
+
|
| 231 |
+
# Get compounds with their sample counts
|
| 232 |
+
compound_counts = df.groupby('SMILES').size().reset_index(name='count')
|
| 233 |
+
compound_counts = compound_counts.sample(frac=1, random_state=seed).reset_index(drop=True) # Shuffle
|
| 234 |
+
|
| 235 |
+
# Target sample counts
|
| 236 |
+
total_samples = len(df)
|
| 237 |
+
target_train = int(train_ratio * total_samples)
|
| 238 |
+
target_val = int(val_ratio * total_samples)
|
| 239 |
+
target_test = total_samples - target_train - target_val
|
| 240 |
+
|
| 241 |
+
print(f"\n Target sample distribution:")
|
| 242 |
+
print(f" Train: {target_train:,} ({train_ratio*100:.0f}%)")
|
| 243 |
+
print(f" Val: {target_val:,} ({val_ratio*100:.0f}%)")
|
| 244 |
+
print(f" Test: {target_test:,} ({(1-train_ratio-val_ratio)*100:.0f}%)")
|
| 245 |
+
|
| 246 |
+
# Greedy assignment: assign compounds to splits to match target ratios
|
| 247 |
+
train_compounds = []
|
| 248 |
+
val_compounds = []
|
| 249 |
+
test_compounds = []
|
| 250 |
+
|
| 251 |
+
train_count = 0
|
| 252 |
+
val_count = 0
|
| 253 |
+
test_count = 0
|
| 254 |
+
|
| 255 |
+
for _, row in compound_counts.iterrows():
|
| 256 |
+
compound = row['SMILES']
|
| 257 |
+
count = row['count']
|
| 258 |
+
|
| 259 |
+
# Assign to the split that needs samples most
|
| 260 |
+
train_deficit = target_train - train_count
|
| 261 |
+
val_deficit = target_val - val_count
|
| 262 |
+
test_deficit = target_test - test_count
|
| 263 |
+
|
| 264 |
+
if train_deficit >= val_deficit and train_deficit >= test_deficit:
|
| 265 |
+
train_compounds.append(compound)
|
| 266 |
+
train_count += count
|
| 267 |
+
elif val_deficit >= test_deficit:
|
| 268 |
+
val_compounds.append(compound)
|
| 269 |
+
val_count += count
|
| 270 |
+
else:
|
| 271 |
+
test_compounds.append(compound)
|
| 272 |
+
test_count += count
|
| 273 |
+
|
| 274 |
+
train_compounds = set(train_compounds)
|
| 275 |
+
val_compounds = set(val_compounds)
|
| 276 |
+
test_compounds = set(test_compounds)
|
| 277 |
+
|
| 278 |
+
# Assign samples based on compound
|
| 279 |
+
train_df = df[df['SMILES'].isin(train_compounds)].copy()
|
| 280 |
+
val_df = df[df['SMILES'].isin(val_compounds)].copy()
|
| 281 |
+
test_df = df[df['SMILES'].isin(test_compounds)].copy()
|
| 282 |
+
|
| 283 |
+
print(f"\n Split compounds:")
|
| 284 |
+
print(f" Train: {len(train_compounds)} compounds ({len(train_df):,} samples, {100*len(train_df)/len(df):.1f}%)")
|
| 285 |
+
print(f" Val: {len(val_compounds)} compounds ({len(val_df):,} samples, {100*len(val_df)/len(df):.1f}%)")
|
| 286 |
+
print(f" Test: {len(test_compounds)} compounds ({len(test_df):,} samples, {100*len(test_df)/len(df):.1f}%)")
|
| 287 |
+
|
| 288 |
+
# Verify disjointness
|
| 289 |
+
assert len(train_compounds & val_compounds) == 0, "Train and val compounds overlap!"
|
| 290 |
+
assert len(train_compounds & test_compounds) == 0, "Train and test compounds overlap!"
|
| 291 |
+
assert len(val_compounds & test_compounds) == 0, "Val and test compounds overlap!"
|
| 292 |
+
|
| 293 |
+
print(f"\n ✓ Compound-disjoint verified: no compound overlap across splits")
|
| 294 |
+
|
| 295 |
+
# Check RNA overlap (expected)
|
| 296 |
+
train_rnas = set(train_df['RNA_seq'].unique())
|
| 297 |
+
val_rnas = set(val_df['RNA_seq'].unique())
|
| 298 |
+
test_rnas = set(test_df['RNA_seq'].unique())
|
| 299 |
+
|
| 300 |
+
overlap_train_val = len(train_rnas & val_rnas)
|
| 301 |
+
overlap_train_test = len(train_rnas & test_rnas)
|
| 302 |
+
|
| 303 |
+
print(f"\n RNA overlap (expected):")
|
| 304 |
+
print(f" Train-Val: {overlap_train_val} RNAs")
|
| 305 |
+
print(f" Train-Test: {overlap_train_test} RNAs")
|
| 306 |
+
|
| 307 |
+
return train_df, val_df, test_df
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
def save_splits(train_df, val_df, test_df, output_dir, dataset_name):
|
| 311 |
+
"""Save splits to files."""
|
| 312 |
+
output_path = Path(output_dir)
|
| 313 |
+
output_path.mkdir(parents=True, exist_ok=True)
|
| 314 |
+
|
| 315 |
+
# Save CSV files
|
| 316 |
+
train_df.to_csv(output_path / 'train_text.csv', index=False)
|
| 317 |
+
val_df.to_csv(output_path / 'val_text.csv', index=False)
|
| 318 |
+
test_df.to_csv(output_path / 'test_text.csv', index=False)
|
| 319 |
+
|
| 320 |
+
# Create report
|
| 321 |
+
report = f"""# {dataset_name} Dataset Report
|
| 322 |
+
|
| 323 |
+
## Overview
|
| 324 |
+
Disjoint splits created from drug_rna_cds_sampled_11 dataset.
|
| 325 |
+
|
| 326 |
+
## Split Statistics
|
| 327 |
+
|
| 328 |
+
### Sample Counts
|
| 329 |
+
- Train: {len(train_df):,} samples ({100*train_df['label'].mean():.1f}% positive)
|
| 330 |
+
- Val: {len(val_df):,} samples ({100*val_df['label'].mean():.1f}% positive)
|
| 331 |
+
- Test: {len(test_df):,} samples ({100*test_df['label'].mean():.1f}% positive)
|
| 332 |
+
- Total: {len(train_df) + len(val_df) + len(test_df):,} samples
|
| 333 |
+
|
| 334 |
+
### Unique Entities
|
| 335 |
+
|
| 336 |
+
#### Compounds
|
| 337 |
+
- Train: {train_df['SMILES'].nunique():,}
|
| 338 |
+
- Val: {val_df['SMILES'].nunique():,}
|
| 339 |
+
- Test: {test_df['SMILES'].nunique():,}
|
| 340 |
+
|
| 341 |
+
#### RNAs
|
| 342 |
+
- Train: {train_df['RNA_seq'].nunique():,}
|
| 343 |
+
- Val: {val_df['RNA_seq'].nunique():,}
|
| 344 |
+
- Test: {test_df['RNA_seq'].nunique():,}
|
| 345 |
+
|
| 346 |
+
## Disjointness Properties
|
| 347 |
+
|
| 348 |
+
### Compound Disjointness
|
| 349 |
+
- Train-Val compound overlap: {len(set(train_df['SMILES'].unique()) & set(val_df['SMILES'].unique()))}
|
| 350 |
+
- Train-Test compound overlap: {len(set(train_df['SMILES'].unique()) & set(test_df['SMILES'].unique()))}
|
| 351 |
+
- Val-Test compound overlap: {len(set(val_df['SMILES'].unique()) & set(test_df['SMILES'].unique()))}
|
| 352 |
+
|
| 353 |
+
### RNA Disjointness
|
| 354 |
+
- Train-Val RNA overlap: {len(set(train_df['RNA_seq'].unique()) & set(val_df['RNA_seq'].unique()))}
|
| 355 |
+
- Train-Test RNA overlap: {len(set(train_df['RNA_seq'].unique()) & set(test_df['RNA_seq'].unique()))}
|
| 356 |
+
- Val-Test RNA overlap: {len(set(val_df['RNA_seq'].unique()) & set(test_df['RNA_seq'].unique()))}
|
| 357 |
+
|
| 358 |
+
## Output Format
|
| 359 |
+
Same as drug_rna_cds_sampled_11:
|
| 360 |
+
- Columns: RNA_ID, Compound_ID, RNA_seq, SMILES, text, label
|
| 361 |
+
- Files: train_text.csv, val_text.csv, test_text.csv
|
| 362 |
+
|
| 363 |
+
## Use Case
|
| 364 |
+
This split tests the model's ability to generalize to:
|
| 365 |
+
- {'New compounds AND new RNAs' if 'disjoint' in dataset_name and 'rna' not in dataset_name and 'compound' not in dataset_name else 'New RNAs' if 'rna' in dataset_name else 'New compounds' if 'compound' in dataset_name else 'New samples'}
|
| 366 |
+
|
| 367 |
+
Date: {pd.Timestamp.now().strftime('%Y-%m-%d %H:%M:%S')}
|
| 368 |
+
"""
|
| 369 |
+
|
| 370 |
+
with open(output_path / 'DATASET_REPORT.md', 'w') as f:
|
| 371 |
+
f.write(report)
|
| 372 |
+
|
| 373 |
+
print(f"\n Saved to: {output_path}")
|
| 374 |
+
print(f" - train_text.csv")
|
| 375 |
+
print(f" - val_text.csv")
|
| 376 |
+
print(f" - test_text.csv")
|
| 377 |
+
print(f" - DATASET_REPORT.md")
|
| 378 |
+
|
| 379 |
+
|
| 380 |
+
def main():
|
| 381 |
+
parser = argparse.ArgumentParser(
|
| 382 |
+
description="Create disjoint splits from drug_rna_cds_sampled_11"
|
| 383 |
+
)
|
| 384 |
+
parser.add_argument(
|
| 385 |
+
'--input',
|
| 386 |
+
default='datasets/drug_rna_cds_sampled_11',
|
| 387 |
+
help='Input dataset directory'
|
| 388 |
+
)
|
| 389 |
+
parser.add_argument(
|
| 390 |
+
'--seed',
|
| 391 |
+
type=int,
|
| 392 |
+
default=42,
|
| 393 |
+
help='Random seed'
|
| 394 |
+
)
|
| 395 |
+
|
| 396 |
+
args = parser.parse_args()
|
| 397 |
+
|
| 398 |
+
print("=" * 80)
|
| 399 |
+
print("CREATING DISJOINT SPLITS FROM drug_rna_cds_sampled_11")
|
| 400 |
+
print("=" * 80)
|
| 401 |
+
|
| 402 |
+
# Load data
|
| 403 |
+
input_path = Path(args.input)
|
| 404 |
+
|
| 405 |
+
# Combine all splits from source
|
| 406 |
+
dfs = []
|
| 407 |
+
for split in ['train', 'val', 'test']:
|
| 408 |
+
csv_path = input_path / f'{split}_text.csv'
|
| 409 |
+
if csv_path.exists():
|
| 410 |
+
dfs.append(pd.read_csv(csv_path))
|
| 411 |
+
|
| 412 |
+
df = pd.concat(dfs, ignore_index=True)
|
| 413 |
+
print(f"\nLoaded {len(df):,} samples from {input_path}")
|
| 414 |
+
|
| 415 |
+
# Analyze feasibility
|
| 416 |
+
fully_disjoint_feasible = analyze_disjoint_feasibility(df)
|
| 417 |
+
|
| 418 |
+
# 1. Try fully disjoint
|
| 419 |
+
if fully_disjoint_feasible:
|
| 420 |
+
print("\n" + "#" * 80)
|
| 421 |
+
print("# CREATING: drug_rna_cds_disjoint (FULLY DISJOINT)")
|
| 422 |
+
print("#" * 80)
|
| 423 |
+
|
| 424 |
+
result = create_fully_disjoint_split(df, seed=args.seed)
|
| 425 |
+
if result is not None:
|
| 426 |
+
train_df, val_df, test_df = result
|
| 427 |
+
save_splits(
|
| 428 |
+
train_df, val_df, test_df,
|
| 429 |
+
'datasets/drug_rna_cds_disjoint',
|
| 430 |
+
'drug_rna_cds_disjoint'
|
| 431 |
+
)
|
| 432 |
+
else:
|
| 433 |
+
print("\n ⚠️ Skipping fully disjoint split - not practical for this dataset")
|
| 434 |
+
else:
|
| 435 |
+
print("\n ⚠️ Skipping fully disjoint split - not enough samples")
|
| 436 |
+
|
| 437 |
+
# 2. Create RNA-disjoint
|
| 438 |
+
print("\n" + "#" * 80)
|
| 439 |
+
print("# CREATING: drug_rna_cds_disjoint_rna (RNA-DISJOINT)")
|
| 440 |
+
print("#" * 80)
|
| 441 |
+
|
| 442 |
+
train_df, val_df, test_df = create_rna_disjoint_split(df, seed=args.seed)
|
| 443 |
+
save_splits(
|
| 444 |
+
train_df, val_df, test_df,
|
| 445 |
+
'datasets/drug_rna_cds_disjoint_rna',
|
| 446 |
+
'drug_rna_cds_disjoint_rna'
|
| 447 |
+
)
|
| 448 |
+
|
| 449 |
+
# 3. Create compound-disjoint
|
| 450 |
+
print("\n" + "#" * 80)
|
| 451 |
+
print("# CREATING: drug_rna_cds_disjoint_compound (COMPOUND-DISJOINT)")
|
| 452 |
+
print("#" * 80)
|
| 453 |
+
|
| 454 |
+
train_df, val_df, test_df = create_compound_disjoint_split(df, seed=args.seed)
|
| 455 |
+
save_splits(
|
| 456 |
+
train_df, val_df, test_df,
|
| 457 |
+
'datasets/drug_rna_cds_disjoint_compound',
|
| 458 |
+
'drug_rna_cds_disjoint_compound'
|
| 459 |
+
)
|
| 460 |
+
|
| 461 |
+
print("\n" + "=" * 80)
|
| 462 |
+
print("ALL DISJOINT SPLITS CREATED SUCCESSFULLY")
|
| 463 |
+
print("=" * 80)
|
| 464 |
+
print("\nCreated datasets:")
|
| 465 |
+
if fully_disjoint_feasible:
|
| 466 |
+
print(" 1. drug_rna_cds_disjoint - Fully disjoint (compounds AND RNAs)")
|
| 467 |
+
print(" 2. drug_rna_cds_disjoint_rna - RNA-disjoint")
|
| 468 |
+
print(" 3. drug_rna_cds_disjoint_compound - Compound-disjoint")
|
| 469 |
+
|
| 470 |
+
|
| 471 |
+
if __name__ == "__main__":
|
| 472 |
+
main()
|