Datasets:
Languages:
English
Size:
10M<n<100M
Tags:
biomedical
negative-results
benchmark
drug-target-interaction
clinical-trials
protein-protein-interaction
License:
Patch Notes: Experiment Pipeline Fixes
Date: 2026-03-10
Scope
This patch fixes experiment orchestration bugs found during review across:
src/negbiodb/export.pyscripts/train_baseline.pyscripts/prepare_exp_data.pyscripts/collect_results.pytests/test_pipeline_scripts.py
Bugs Fixed
1. Split export row fanout with multiple split versions
Problem:
export_negative_dataset()joined split columns bysplit_strategy.- If
random_v2or another later split definition existed for the same strategy, the export query could duplicate rows.
Fix:
- Export now resolves a single latest
split_idper strategy before joiningsplit_assignments. - Cold split integrity checks were aligned to use the latest split definition too.
- Split selection now prefers explicit version semantics (
versioncolumn and_vNsuffixes) rather than raw insertion order.
Impact:
- Prevents silent corruption of
negbiodb_dti_pairs.parquetwhen new split versions are added.
2. Incomplete graph cache silently degrading GraphDTA/DrugBAN
Problem:
- Existing
graph_cache.ptfiles could be incomplete. - Missing SMILES fell through to placeholder graphs during batching.
- When no cache existed, train fold could save a train-only cache that val/test later reused.
Fix:
- Added
_prepare_graph_cache()intrain_baseline.py. - The cache is now built or backfilled against the full dataset parquet before folds are created.
DTIDataset._load_graphs()also backfills missing SMILES if a partial cache path is still passed in.
Impact:
- Prevents valid molecules from silently training/evaluating as dummy graphs.
3. Training run outputs overwriting each other
Problem:
- Output directories were keyed only by
model/split/negative. - Different datasets or seeds could overwrite prior runs.
Fix:
- Run names now include
datasetandseed. - Added
_build_run_name()helper to keep naming deterministic and testable.
Impact:
- Balanced vs. realistic and multi-seed runs can now coexist safely.
3b. Unsupported realistic Exp 1 controls now fail fast
Problem:
uniform_randomanddegree_matchedcontrols did not have realistic dataset variants.- The CLI still accepted
--dataset realisticfor those negatives, which mislabeled balanced-control runs as realistic.
Fix:
- Removed those unsupported mappings from
train_baseline.py. - The CLI now rejects realistic random-control combinations explicitly.
Impact:
- Prevents mislabeled Exp 1 results from being written to disk and summarized later.
4. Invalid DDB CLI combinations
Problem:
ddbwas exposed as a negative source even though it is a split mode.- Commands like
--split random --negative ddbwere accepted.
Fix:
- Removed
ddbfrom--negativechoices. - Added explicit validation so DDB is only valid for
split=ddb,negative=negbiodb, anddataset=balanced.
Impact:
- Reduces mislabeled experiment runs and ambiguous result directories.
5. prepare_exp_data.py --skip-exp4 still required the pairs parquet
Problem:
- Input validation always required
exports/negbiodb_dti_pairs.parquet, even when Exp 4 was being skipped.
Fix:
- Conditionalized required inputs so the large pairs parquet is only required when Exp 4 runs.
- Added defensive deduplication and
many_to_onemerge validation inprepare_exp4_ddb().
Impact:
- Exp 1 preparation can now run independently.
6. Result collection mixed datasets and hid seed information
Problem:
collect_results.pydroppeddatasetandseedfrom Table 1 output.- Exp 1 summary selected the first matching row instead of grouping safely.
Fix:
- Table output now preserves
datasetandseed. - Exp 1 summary is now grouped by dataset and averages only across seeds present in all compared negative conditions.
Impact:
- Prevents balanced/realistic runs from being conflated in downstream summaries.
6b. Result collection now supports explicit dataset/seed filters
Problem:
collect_results.pypreviously aggregated every run underresults/baselines/.- As more experiments accumulate, paper tables can accidentally mix exploratory and final runs.
Fix:
- Added
--datasetand repeatable--seedfilters tocollect_results.py. - Added repeatable
--model,--split, and--negativefilters too. - The command now fails fast if filters remove all rows.
- Added optional
--aggregate-seedsoutput that writestable1_aggregated.csvwith mean/std over seeds. - Added
table1_aggregated.mdwith human-readablemean +/- stdformatting.
Impact:
- Makes paper/report generation reproducible from an explicit run subset.
- Adds a paper-friendly seed-aggregated summary without removing access to raw runs.
7. SLURM submission metadata aligned with current run naming
Problem:
- SLURM job names and log file names did not include dataset or seed.
- Submission wrappers relied on implicit defaults instead of exporting
DATASETandSEEDexplicitly.
Fix:
- Updated SLURM wrapper scripts to include dataset and seed in job/log naming.
- Submission wrappers now export
DATASETandSEEDexplicitly to the training job. - Training job logging now prints seed together with model/split/negative/dataset.
Impact:
- Makes cluster logs line up with the run directories and result-collection filters.
7b. SLURM submission scripts now support seed sweeps
Problem:
- Multi-seed experiments required manual resubmission or manual editing of shell scripts.
Fix:
- Added
SEEDS="42 43 44"style support to SLURM submission wrappers. - Added optional
MODELS,SPLITS, andNEGATIVESfilters tosubmit_all.sh. - Default behavior remains
SEEDS=42, preserving the prior single-seed workflow.
Impact:
- Makes it straightforward to launch reproducible seed sweeps that match
collect_results.py --seed .... - Makes selective experiment submission possible without editing shell scripts.
7c. Added Cayuga SSH helper wrappers for remote submission and monitoring
Problem:
- The documented Cayuga workflow relies on SSH ControlMaster and non-interactive remote commands.
- Reconstructing the exact remote submit/monitor commands by hand is error-prone.
Fix:
- Added
slurm/remote_submit_cayuga.shto callsubmit_all.shremotely viassh ${HPC_LOGIN:-cayuga-login1}. - Added
slurm/remote_monitor_cayuga.shto inspectsqueueand recent log files remotely. - Made SLURM binary paths overridable via
SBATCH_BIN/SQUEUE_BIN.
Impact:
- Makes the repository align directly with the Cayuga SSH workflow documented in the lab notes.
Regression Tests Added
Added tests/test_pipeline_scripts.py covering:
- export uses latest split version without row duplication
prepare_exp_data.py --skip-exp4no longer requires the pairs parquet- run names include dataset and seed
- invalid DDB dataset resolution is rejected
- unsupported realistic random-control runs are rejected
train_baseline.pyrejectssplit=ddbwithdataset=realistictrain_baseline.pywrites results into a dataset+seed-qualified run directory- graph cache backfills missing SMILES
- result collection preserves dataset/seed and groups Exp 1 summaries by dataset using matched seeds only
- result collection can filter by dataset and seed before building tables
- result collection can also filter by model, split, and negative source
- result collection can optionally write seed-aggregated tables
- result collection writes both aggregated CSV and aggregated Markdown summaries
- SLURM job/log names now include dataset and seed, matching run output naming
- SLURM submission wrappers support multi-seed sweeps via the
SEEDSenvironment variable submit_all.shcan filter submitted experiments by model, split, and negative source- Added remote Cayuga SSH helper scripts for submission and monitoring
Verification
Commands run:
uv run pytest tests/test_export.py -q
uv run pytest tests/test_pipeline_scripts.py -q
Observed results:
tests/test_export.py: 52 passedtests/test_pipeline_scripts.py: 17 passed, 1 skipped
Skip reason:
- the graph cache backfill test is skipped when
torchis unavailable in the environment
Follow-up
Recommended next step:
- add one end-to-end script test that exercises
train_baseline.pyCLI with heavy training functions mocked out, to lock down argument validation and results writing behavior together
Lessons Learned (2026-03-12)
1. Exp 4 must be defined as a full-task split, not a negative-only transform
What we learned:
- Treating DDB as "only reassign negatives while positives keep
split_random" weakens the claim. - That setup mixes split bias with class-specific handling and no longer measures the benchmark-level effect of node-degree bias.
Decision:
- Exp 4 is now defined as a full-task degree-balanced split on merged M1 balanced data.
- Positives and negatives must be reassigned together under the same
split_degree_balancedpolicy.
Operational rule:
- Any future regeneration of
exports/negbiodb_m1_balanced_ddb.parquetmust be done from the merged M1 benchmark, not by patching only the negative subset.
2. Eval-only rewrites can make stale checkpoints look fresh
What we learned:
- Using
results.jsonmodification time alone is not a reliable freshness signal. eval_checkpoint.pycan rewrite results for an old checkpoint and make a stale run appear newly generated.
Decision:
- Freshness checks must use training artifacts first (
best.pt,last.pt,training_log.csv) and only fall back toresults.jsonif no training artifacts exist.
Operational rule:
- Any future result filtering or release packaging should treat checkpoint/log timestamps as the source of truth for run freshness.
3. DDB benchmark regeneration invalidates prior DDB model results
What we learned:
- Once
exports/negbiodb_m1_balanced_ddb.parquetchanges, all prior*_ddb_*model results become semantically stale even if files still parse. - Silent reuse of those results is more dangerous than having missing rows.
Decision:
collect_results.pynow excludes stale DDB runs by default when they are older than the current DDB parquet.
Operational rule:
- After any future DDB regeneration, immediately retrain the DDB model trio before producing paper tables.
4. Remote HPC execution can drift from local fixes
What we learned:
- The Cayuga working directory is effectively a deployed copy, not a git-controlled checkout.
- Local fixes do not automatically exist on the remote side, so "submitted successfully" does not imply "submitted the corrected code."
Decision:
- Before remote submission, explicitly sync changed code or regenerate artifacts in place on Cayuga.
- For large derived files, remote regeneration is usually safer than bulk transfer.
Operational rule:
- Prefer:
- sync small code/script changes
- regenerate derived artifacts on Cayuga
- then submit jobs
5. Submission wrappers need shell syntax coverage, not just static review
What we learned:
slurm/submit_all.shstill contained loop-closing bugs after functional edits.- These did not surface until the exact submission path was exercised on the remote cluster.
Decision:
- Shell wrappers should be syntax-checked with
bash -nwhenever edited.
Operational rule:
- For any future SLURM wrapper change:
- run
bash -n <script> - then run one narrow submission command before treating the wrapper as good
- run
Future Reference
Step 4 current ground truth
- Exp 4 =
split=ddb,negative=negbiodb,dataset=balanced - DDB parquet =
exports/negbiodb_m1_balanced_ddb.parquet - DDB parquet is generated from merged M1 balanced data with positives and negatives reassigned together
- Stale DDB results are excluded by default in
scripts/collect_results.py - Override flag if absolutely needed:
--allow-stale-ddb
Safe workflow for future DDB reruns
- Sync changed code to Cayuga.
- Regenerate DDB parquet on Cayuga:
source ${CONDA_PREFIX:-/path/to/conda}/miniconda3/etc/profile.d/conda.shconda activate negbiodb-mlcd ${SCRATCH_DIR:-/path/to/scratch}/negbiodbpython scripts/prepare_exp_data.py --skip-exp1
- Submit only DDB jobs:
SEEDS="42" MODELS="deepdta graphdta drugban" SPLITS="ddb" NEGATIVES="negbiodb" DATASETS="balanced" bash slurm/submit_all.sh
- Verify queue state:
/opt/ohpc/pub/software/slurm/24.05.2/bin/squeue -u ${USER}
- Re-collect tables after those runs finish.
Current known-good DDB submission example
Successful Cayuga submission on 2026-03-12:
negbio_deepdta_balanced_ddb_negbiodb_seed42→ job2702356negbio_graphdta_balanced_ddb_negbiodb_seed42→ job2702357negbio_drugban_balanced_ddb_negbiodb_seed42→ job2702358
Files to inspect first next time
scripts/prepare_exp_data.pysrc/negbiodb/export.pyscripts/collect_results.pyscripts/train_baseline.pyscripts/eval_checkpoint.pyslurm/submit_all.shtests/test_pipeline_scripts.py