MIRAGE is a training package for antibody-antigen DMS mutation ranking on AbAgym. The prediction task is within-DMS mutation ranking, not absolute binding free-energy regression.
The final MIRAGE model is a leave-antigen-family-out monotonic histogram-gradient-boosting calibrator over five branch scores:
foldx: clipped FoldX complex mutation-energy score.rsa: negative relative solvent accessibility.struct: learned structural-context ranker score.esm_lora_listwise: ESM2-LoRA listwise mutation-ranker score.chem_hgb: chemistry plus local-structure HGB branch score.
Create the MIRAGE Conda environment:
conda env create -f environment.yml
conda activate mirageAlternatively, install the same dependencies with pip:
python3 -m pip install -r requirements.txtThe packaged AbAgym mutation table contains 36,541 source records:
data/abagym_interface_study_rank_records.csv
The package also includes processed local structural descriptors:
data/abagym_official_structure_features.npz
data/abagym_official_structure_features.json
Generated predictions and metrics are intentionally not tracked. They are
written under results/ when users run the training scripts.
The complete training workflow is available as a single shell script:
FOLDX_DIR=/path/to/abagym_foldx_outputs \
STRUCTURE_DIR=/path/to/abagym_modeled_pdbs \
DEVICE=cuda:0 \
bash scripts/train_mirage_from_scratch.shThis script trains the five MIRAGE branches and then trains/evaluates the final
monotonic HGB fusion model. It writes branch outputs to
results/branch_predictions/ and final outputs to results/final/.
The full run requires external assets that are too large or license-dependent to store in this repository:
FOLDX_DIR: AbAgym FoldX output directory. Each PDB subdirectory must contain acomplex_ddG_values.csvfile.STRUCTURE_DIR: AbAgym modeled antibody-antigen PDB structures, named by thePDB_filecolumn indata/abagym_interface_study_rank_records.csv.- HuggingFace/PyTorch access to
facebook/esm2_t30_150M_UR50D, unless the model is already cached locally. SetESM_LOCAL_FILES_ONLY=1to force local cache use. - A CUDA GPU is strongly recommended for the ESM2-LoRA branch.
Optional environment variables:
PYTHON_BIN=/path/to/python
RESULTS_DIR=results
DEVICE=cuda:0
ESM_MODEL_NAME=facebook/esm2_t30_150M_UR50D
STRUCTURE_ID_COLUMN=PDB_file
SAVE_ESM_CHECKPOINTS=1MIRAGE training is staged. First generate branch-score tables, then train the final fusion model.
Expected branch-score output paths:
results/branch_predictions/four_branch_base_predictions.csv
results/branch_predictions/chem_hgb_predictions.csv
The final fusion script consumes those two tables:
bash scripts/reproduce_final_fusion.shIt writes:
results/reproduced_final_fusion/monotonic_hgb/predictions.csv
results/reproduced_final_fusion/monotonic_hgb/paper_metrics.json
results/reproduced_final_fusion/monotonic_hgb/paper_metrics.csv
results/reproduced_final_fusion/monotonic_hgb/summary.json
If your branch-score files are elsewhere, set:
BASE_PRED=/path/to/four_branch_base_predictions.csv \
CHEM_PRED=/path/to/chem_hgb_predictions.csv \
bash scripts/reproduce_final_fusion.shSome branches require external assets that are not stored in this repository.
See EXTERNAL_ASSETS.md for the expected directory layout.
- FoldX branch requires the AbAgym FoldX output directory containing
complex_ddG_values.csvfiles. - RSA branch requires modeled antibody-antigen PDB structures.
- ESM2-LoRA branch requires modeled antibody-antigen PDB structures,
HuggingFace/PyTorch access to
facebook/esm2_t30_150M_UR50D, and a GPU for practical runtime. - The chemistry branch can be rerun from the packaged records, packaged structure features, and a four-branch base prediction table.
MIRAGE/
EXTERNAL_ASSETS.md
data/
abagym_interface_study_rank_records.csv
abagym_official_structure_features.npz
abagym_official_structure_features.json
abagym_study_summary.csv
abagym_prepare_audit.json
scripts/
prepare_abagym_study_disjoint.py
build_abagym_structure_features.py
evaluate_abagym_foldx_scores.py
evaluate_abagym_rsa_baseline.py
train_abagym_study_disjoint_ranknet.py
train_abagym_esm_adapter_ranker.py
train_abagym_retrieval_chem_fusion.py
build_mirage_branch_tables.py
fit_abagym_fusion_model_zoo.py
score_abagym_predictions_like_paper.py
train_mirage_from_scratch.sh
reproduce_final_fusion.sh
results/
branch_predictions/
final/
The final evaluated row count can be smaller than 36,541 because the final fusion model uses the intersection of records with all required branch scores.