ReACT-Drug: Reaction-Template Guided Reinforcement Learning for de novo Drug Design
December 24, 2025 ยท View on GitHub
A complete reinforcement learning pipeline for de novo molecular drug design using reaction-template guided molecular transformations.
Overview
ReACT-Drug is an end-to-end RL framework that combines deep representation learning with multi-objective molecular optimization. Given a target protein, the system:
- Identifies similar proteins using ESM-2 embeddings from the PDBbind database
- Fragments known ligands using BRICS/RECAP to create starting molecules
- Grows molecules using ChEMBL-derived reaction templates
- Optimizes for binding affinity (AutoDock Vina), drug-likeness (QED), synthetic accessibility, and novelty
Features
- ๐งฌ ESM-2 protein embeddings for similarity search
- ๐ ChemBERTa molecular embeddings for state representation
- ๐งช ChEMBL-derived reaction templates for chemically valid transformations
- ๐ฌ AutoDock Vina integration for binding affinity scoring
- ๐ค PPO with dynamic action spaces for multi-objective optimization
- ๐งฉ Fragment-based starting state generation
Installation
# Clone repository
git clone https://github.com/YadunandanRaman/ReACT-Drug.git
cd ReACT-Drug
# Create conda environment
conda create -n react-drug python=3.10
conda activate react-drug
# Install dependencies
pip install -r requirements.txt
# Install AutoDock Vina (for docking)
conda install -c conda-forge autodock-vina
# Install Open Babel
conda install -c conda-forge openbabel
Directory Structure
ReACT-Drug/
โโโ data/ # Create this directory (see Data Preparation)
โ โโโ raw/ # PDBbind tar.gz and PDB files
โ โโโ processed/ # Processed binding data (auto-generated)
โ โโโ templates/ # Place drug_templates.pkl here
โโโ src/
โ โโโ __init__.py
โ โโโ config.py # Hyperparameters and paths
โ โโโ encoders.py # ESM-2 and ChemBERTa models
โ โโโ chemistry.py # Fragmentation, Templates, Rewards
โ โโโ docking.py # AutoDock Vina wrapper
โ โโโ environment.py # Gym-like RL Environment
โ โโโ agent.py # PPO Actor-Critic Agent
โ โโโ utils.py # Data loading helpers
โโโ scripts/
โ โโโ generate_templates.py # ChEMBL MMP extraction
โโโ models/ # Saved model checkpoints
โโโ results/ # Discovery results
โโโ main.py # Entry point
โโโ requirements.txt
โโโ README.md
Data Preparation
Note: The
data/directory is not included in this repository due to file size and licensing restrictions. You must create it and download the required files manually.
Step 1: Create Data Directories
mkdir -p data/raw data/processed data/templates
Step 2: Download PDBbind Dataset
The PDBbind dataset is required for training. Due to licensing requirements, please download directly from the official source.
For Academic Use:
- Visit: https://www.pdbbind-plus.org.cn/download
- Register for a free academic account
- Download:
PDBbind_v2020_refined.tar.gz - Place in
data/raw/
For Commercial Use:
- Visit: https://www.pdbbind-plus.org.cn/download
- Contact PDBbind for commercial licensing information
Step 3: Download Reaction Templates
Download the pre-computed ChEMBL-derived reaction templates:
๐ฅ Download drug_templates.pkl
Place the downloaded file in data/templates/
Alternative: Generate templates yourself using ChEMBL data:
python scripts/generate_templates.py
Verify Setup
After completing the above steps, your data directory should look like:
data/
โโโ raw/
โ โโโ PDBbind_v2020_refined.tar.gz
โโโ processed/
โ โโโ (empty - will be auto-generated on first run)
โโโ templates/
โโโ drug_templates.pkl
Usage
Basic Usage
python main.py --pdb_id 4nc3 --episodes 200
Advanced Options
python main.py \
--pdb_id 6lu7 \
--binding_site "10.5,20.3,30.1" \
--episodes 500 \
--max_structures 10000 \
--seed 42
Using Local PDB File
python main.py \
--pdb_file path/to/protein.pdb \
--binding_site "x,y,z" \
--episodes 300
Configuration
All hyperparameters can be modified in src/config.py:
CONFIG = {
"discovery": {
"episodes": 500,
"max_steps_per_episode": 15,
"success_criteria": {
"binding_affinity": -8.5, # kcal/mol
"qed_score": 0.5,
"sa_score": 4.0,
},
},
"training": {
"learning_rate": 1e-4,
"batch_size": 32,
"ppo_epochs": 10,
"clip_ratio": 0.2,
},
# ... more options
}