| # NAIAD Dataset Package |
|
|
| This package contains the train/valid/test CSV index files used immediately before NAIAD training, plus every referenced `.cif` source structure. |
|
|
| ## Contents |
|
|
| - `data/*.csv`: model input index files. `structure_path` has been rewritten to package-relative paths such as `structures/101d.cif`. |
| - `structures/*.cif`: all 3725 unique source structures referenced by the packaged CSV files. |
| - `splits/*.json`: released split ID lists used to derive train/valid/test sets. |
| - `scripts/`: preprocessing, filtering, CSV-generation, and split/preparation scripts from the training repository. |
| - `configs/`: NAIAD training config. |
|
|
| The `.cif` files were reconstructed locally from the official wwPDB/RCSB mmCIF mirrors using the PDB IDs in `manifest.csv`. |
| Use `scripts/download_structures_from_manifest.py` to reproduce this step. |
|
|
| The parser still expects the normal NAIAD chemical component cache (`ligands.json.gz` and `elements.txt`) under the repository's `data/datasets/rcsb_cif/`, or via `NAIAD_RCSB_CIF_DIR`. |
|
|
| For the reported NAIAD training-data release, use `data/train.csv` as the training index, `data/valid.csv` as validation, and `data/test.csv` as the held-out test index. |
|
|
| To use after extraction, point `DF_PATH_TRAIN` and `DF_PATH_VALID` to `data/train.csv` and `data/valid.csv` from this package, or copy the package contents under the repository root so the relative `structure_path` values resolve. |
|
|
| ## Reproducing The Split CSVs |
|
|
| There are two different workflows in `scripts/`. |
|
|
| ### Exact packaged train/valid/test CSVs |
|
|
| Use this route to reproduce the three split CSVs bundled in `data/` from the released split ID files and the packaged CIF files: |
|
|
| ```bash |
| python scripts/generate_training_csv_from_splits.py \ |
| --mmcif_dir structures \ |
| --splits_dir splits \ |
| --output_dir reproduced_data \ |
| --split_type design |
| ``` |
|
|
| Expected result when run against this package: |
|
|
| - `reproduced_data/train.csv`: 3096 rows. |
| - `reproduced_data/valid.csv`: 308 rows. |
| - `reproduced_data/test.csv`: 321 rows. |
|
|
| The row IDs match the shipped `data/train.csv`, `data/valid.csv`, and `data/test.csv`. This is because the script reads the full split ID lists and keeps only IDs whose CIF file is present under `structures/`. |
| The regenerated CSVs will contain absolute `structure_path` values because that script calls `os.path.abspath`; the shipped CSVs use package-relative paths such as `structures/101d.cif` for portability. |
|
|
| `generate_training_csv_from_splits.py` requires only normal tabular Python dependencies (`pandas`, `tqdm`) and does not import the NAIAD model/parser code. |
|
|
| ### Full rescan/filter/preprocess/split from a mmCIF mirror |
|
|
| Use this route only if you want to create a new dataset split from an external mmCIF mirror rather than reproduce the packaged split: |
|
|
| ```bash |
| python scripts/prepare_diffusion_dataset_full.py scan \ |
| --mmcif_dir /path/to/mmcif_files \ |
| --output_dir new_dataset \ |
| --num_workers 16 \ |
| --require_na |
| |
| python scripts/prepare_diffusion_dataset_full.py preprocess \ |
| --output_dir new_dataset \ |
| --num_workers 16 |
| |
| # Optional, if CD-HIT is installed. |
| python scripts/prepare_diffusion_dataset_full.py cluster \ |
| --output_dir new_dataset \ |
| --cdhit_path /path/to/cdhit |
| |
| python scripts/prepare_diffusion_dataset_full.py split \ |
| --output_dir new_dataset \ |
| --valid_fraction 0.1 \ |
| --test_fraction 0.1 \ |
| --use_clustering |
| ``` |
|
|
| Equivalent all-in-one form: |
|
|
| ```bash |
| python scripts/prepare_diffusion_dataset_full.py all \ |
| --mmcif_dir /path/to/mmcif_files \ |
| --output_dir new_dataset \ |
| --num_workers 16 \ |
| --require_na \ |
| --valid_fraction 0.1 \ |
| --test_fraction 0.1 |
| ``` |
|
|
| This full workflow performs scanning, quality filtering, per-structure preprocessing, optional CD-HIT sequence clustering, then writes `train.csv`, `valid.csv`, and optionally `test.csv`. |
| It is not the command used to reproduce the fixed manuscript split files in this package. |
|
|
| `prepare_diffusion_dataset_full.py` imports NAIAD parser/data modules (`cifutils.py`, `pdbutils.py`, `na_data_utils.py`) and expects the chemical component cache (`ligands.json.gz`, `elements.txt`). Run it from a NAIAD source checkout or set `PYTHONPATH` so those modules are visible, and set `NAIAD_RCSB_CIF_DIR` if the cache is not under the repository's `data/datasets/rcsb_cif/`. |
|
|
| ### Optional preprocessing of an existing CSV |
|
|
| `preprocess_dataset.py` and `preprocess_dataset.sh` do not create train/valid/test splits. They consume an existing CSV, such as `data/train.csv`, and write per-structure sequence and NumPy preprocessing artifacts: |
|
|
| ```bash |
| python scripts/preprocess_dataset.py \ |
| data/train.csv \ |
| preprocessed/train \ |
| 1 \ |
| 0 |
| ``` |
|
|
| The last two arguments are `modulo` and `remainder`, used for array-job sharding. |
| For example, an HPC array with 100 tasks would run each shard with `modulo=100` and `remainder` equal to the task index. `preprocess_dataset.sh` is an example SLURM/Apptainer wrapper for that sharded mode and may need local cluster/container paths edited before use. |
|
|