This repository contains the code necessary to reproduce CheapVS in paper:
"Preferential Multi-Objective Bayesian Optimization for Drug Discovery".For a quick hands-on demo, open the notebook directly in Google Colab:
For the instructions presented below, we use Python 3.10.8 with miniconda3 and dependencies with their exact version numbers listed in install_deps.sh. We start by installing the necessary dependencies:
chmod +x scripts/install_deps.sh
./chmod +x scripts/install_deps.shTo install diffusion model checkpoints and screening data and expert ranking data, please refer here.
To download the screening data and checkpoints, visit this link. After downloading, unzip the files to your desired directory.
To generate molecular fingerprints, you can use the following script. This script will compute the fingerprints for the molecules in your dataset and ensure that the SMILES are included in the CSV.
python -m cheapvs.fingerprint --csv_file $CSV_FILE --output_npy_file $FINGERPRINTReplace $CSV_FILE with your CSV file and $FINGERPRINT with your designated fingerprint numpy path.
To calculate ligand properties for CheapVS, run the following command. This CSV file is required to run CheapVS later.
python -m cheapvs.get_data --csv_file $CSV_FILE --output_csv_file $OUTPUT_CSVReplace $CSV_FILE with your input CSV file and $OUTPUT_CSV with your designated output CSV file containing the ligand properties.
To run CheapVS using human preferences, execute the following command:
bash scripts/cheapvs.sh $DATA_DIR $DOCKING_MODEL $CSV_FILE $FINGERPRINT $ACQ_FUNCION MW Lipophilicity Half_LifeThis script runs the cheapvs.sh script with the specified parameters.
Parameters:
- $DATA_DIR: Directory containing the data files.
- $DOCKING_MODEL: The docking model to be used, options are (edm, chai, vina).
- $CSV_FILE: Path to the CSV file containing the ligand properties.
- $FINGERPRINT: The path of fingerprint.
- $ACQ_FUNCTION: The acquisition function to be used, options are (qeubo, ucb, pi, ei, ts).
- Ligand Properties: Refer to the function
valid_objectivefromcheapvs/utils.py.
First, we generate and cache the ESM2 embeddings for the proteins to avoid repetitively computing ESM embeddings every time we evaluate a dataset. Here are the instructions for generating these for PDBBind, but it also applies similarly to the other benchmarks.
sh scripts/prep_train_data.shThis generates the ESM embedding for both val and train in the data directory. You need to specify the DATA_DIR flag to store where to store the data.
To generate the cached data for training
sh scripts/gen_data.shChange the $DATA_DIR, $TRAIN_CSV, $VAL_CSV as needed.
The command for distributed training is below. You also need to specify the DATA_DIR flag from above and the model name via the MODEL_NAME flag. For a single GPU training, please consider scripts/train.sh
sh scripts/train_dist.shTo run the Posebusters inference:
sh scripts/eval_posebuster.shChange the DATA_DIR, MODEL_DIR, NAME, and ckpts flags as needed. To additionally save the .sdf files of the generated molecules, add the flag --save_visualisation.
Our model and code are released under CC BY-SA 4.0 License, and can be freely used for both academic and commercial purposes.
If you use this code or the models in your research, please cite the following paper:
@misc{dang2025preferentialmultiobjectivebayesianoptimization,
title={Preferential Multi-Objective Bayesian Optimization for Drug Discovery},
author={Tai Dang and Long-Hung Pham and Sang T. Truong and Ari Glenn and Wendy Nguyen and Edward A. Pham and Jeffrey S. Glenn and Sanmi Koyejo and Thang Luong},
year={2025},
eprint={2503.16841},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2503.16841},
}