A complex-free deep learning model for protein-ligand binding affinity prediction with internal binding site detection.
Key Features:
- Complex-free design: no molecular docking required
- Internal binding site detection: no explicit binding site input required
- Robust performance on imperfect structural inputs
git clone https://github.com/KU-MedAI/InSiteDTA.git
cd InSiteDTAconda env create -f environment.yml
conda activate insiteOur tested environment:
- Python: 3.9.19
- PyTorch: 2.5.1
- PyTorch Geometric: 2.6.1
- CUDA: 11.8
python 01-inference.py \
--pdb_path ./src/data/samples/4gkm/4gkm_protein.pdb \
--smiles "Cc1ccc(c(c1)C(=O)[O-])Nc1ccccc1C(=O)[O-]" \
--ckpt ./src/ckpt/CleanSplit_fold0_s312_teacher.ptOptional:
--save_bs_pdb <path>exports the predicted binding-site residues as a PDB (--save_voxel_pdb <path>for the raw voxel grid;--bs_thresholdtunes the probability cutoff).
Organize your data in nested structure (PDBbind format):
raw_data/
├── {pdb_id}/
│ ├── {pdb_id}_protein.pdb
│ └── {pdb_id}_pocket.pdb
...
Prepare SMILES CSV file (smiles.csv):
PDB_ID,Canonical SMILES
1abc,CCO
1def,c1ccccc1For affinity prediction, prepare affinity index JSON (affinity.json):
{"1abc": 5.2, "1def": 7.8}Note: Affinity labels are loaded from
--index_file(default:src/data/index/affinity_index_pdbbind2020.json). Samples without a matching entry are trained without affinity supervision.
python 02-preprocess.py \
--raw_dir ./raw_data \
--save_dir ./preprocessed \
--smiles_csv ./smiles.csv \
--index_file ./affinity.json \
--test_key_file none \
--voxel_size 2 \
--n_voxels 32 \
--device 002-preprocess.py generates ligand and protein inputs:
./preprocessed/input_ligand/{pdb_id}_ligand.pkl./preprocessed/input_protein/{pdb_id}_voxel.pkl./preprocessed/input_protein/{pdb_id}_center.pkl./preprocessed/data_config_YYMMDD-HHMMSS.json
Set --test_key_file to a text file containing one test PDB ID per line, or use
none to create reproducible random validation and test splits using --seed.
python 03-train.py \
--data_config ./preprocessed/data_config_*.json \
--save_dir ./checkpoints \
--device 0 \
--epochs 300 \
--batch_size 48Training uses self-distillation (an EMA teacher) and saves two checkpoints to --save_dir:
{split}_s{seed}_{timestamp}.pt— student{split}_s{seed}_{timestamp}_teacher.pt— EMA teacher (use this for inference / evaluate / reproduce)
A {split}_s{seed}_{timestamp}_results.json with student/teacher metrics is also written.
python 04-evaluate.py \
--ckpt ./checkpoints/{experiment_name}_teacher.pt \
--result_file ./checkpoints/{experiment_name}_results.json \
--save_dir ./evaluation \
--use_tta \
--device 0--use_tta enables 6-face TTA. Omit it to run single-orientation evaluation.
The script will:
- Load the test split defined in the training result file
- Run 6-face test-time augmentation and average the affinity predictions and spatially aligned pocket logits
- Report performance metrics (PCC, RMSE, MAE, DCC, DCC_SR, DVO)
- Save detailed results to
{save_dir}/{experiment_name}_test_results.csv
Run evaluation across the benchmark scenarios (--scenario: crystal, redocked, p2rank, alphafold):
# Evaluate on Coreset_crystal with 6-face TTA
python 05-reproduce.py --ckpt src/ckpt/CleanSplit_*.pt --scenario crystal --use_tta --device 0
# Evaluate on Coreset_redocked with 6-face TTA
python 05-reproduce.py --ckpt src/ckpt/CleanSplit_*.pt --scenario redocked --use_tta --device 0
# Evaluate on Coreset_p2rank with 6-face TTA
python 05-reproduce.py --ckpt src/ckpt/CleanSplit_*.pt --scenario p2rank --use_tta --device 0
# Evaluate on Coreset_alphafold with 6-face TTA
python 05-reproduce.py --ckpt src/ckpt/CleanSplit_*.pt --scenario alphafold --use_tta --device 0The script will:
- Prepare ligand features from SMILES
- Voxelize protein structures
- Evaluate each provided checkpoint with 6-face TTA (
--ckptaccepts multiple, e.g. multiple seeds) - Report aggregated metrics — mean ± std (PCC, RMSE, MAE, DCC, DCC_SR, DVO)
Inference (01-inference.py):
- Predicted binding affinity in pK scale (higher values = stronger binding)
Training (03-train.py):
- Student checkpoint:
{save_dir}/{split}_s{seed}_{timestamp}.pt - EMA teacher checkpoint:
{save_dir}/{split}_s{seed}_{timestamp}_teacher.pt(used for inference / evaluate / reproduce) - Training results:
{save_dir}/{split}_s{seed}_{timestamp}_results.json
Evaluate (04-evaluate.py):
- Evaluation results CSV:
{save_dir}/{experiment_name}_test_results.csv
Reproduce (05-reproduce.py):
- Aggregated metrics across the provided checkpoints (mean ± std): PCC, RMSE, MAE, DCC, DCC_SR, DVO
- Standard benchmark dataset from PDBbind
- Coreset with redocked ligand in the native pocket
- Ligand redocked into the pocket predicted by P2Rank (Krivák & Hoksza, 2018)
- Protein structures predicted by ColabFold (Mirdita et al., 2022) using AlphaFold-Multimer (Evans et al., 2022) (imperfect-structure benchmark)
TBD