Skip to content

Layne-Huang/PMDM

Repository files navigation

PMDM: A dual diffusion model enables 3D binding bioactive molecule generation and lead optimization given target pockets

Official implementation of PMDM, a dual diffusion model enables 3D binding bioactive molecule generation and lead optimization given target pockets, by Lei Huang.

📢 News

biorxiv DOI

GIF
  1. Dependencies
    1. Conda environment
    2. QuickVina 2
    3. Pre-trained models
  2. Benchmarks
    1. CrossDocked Benchmark
    2. Binding MOAD
  3. Training
  4. Inference
    1. Test set sampling
    2. Sample molecules for a given pocket
    3. Metrics
    4. QuickVina2
  5. Citation

Dependencies

Conda environment

Please use our environment file to install the environment.

# Clone the environment
conda env create -f mol.yml
# Activate the environment
conda activate mol

QuickVina 2

For docking, install QuickVina 2:

wget https://github.com/QVina/qvina/raw/master/bin/qvina2.1
chmod +x qvina2.1

Preparing the receptor for docking (pdb -> pdbqt) requires a new environment which is based on python 2x, so we need to create a new environment:

# Clone the environment
conda env create -f evaluation/env_adt.yml
# Activate the environment
conda activate adt

Pre-trained models

The pre-trained model (500.pt) could be downloaded from Zenodo.

Benchmarks

CrossDocked

Data preparation

Download and extract the dataset is provided in Zenodo

The original CrossDocked dataset can be found at https://bits.csb.pitt.edu/files/crossdock2020/

Binding MOAD

Data preparation

Download the dataset

wget http://www.bindingmoad.org/files/biou/every_part_a.zip
wget http://www.bindingmoad.org/files/biou/every_part_b.zip
wget http://www.bindingmoad.org/files/csv/every.csv

unzip every_part_a.zip
unzip every_part_b.zip

Training

We provide two training scripts train.py and train_ddp_op.py for single-GPU training and multi-GPU training.

Starting a new training run:

python -u train.py --config <config>.yml

The example configure file is in configs/crossdock_epoch.yml

Resuming a previous run:

python -u train.py --config <configure file path>

The config argument should be the upper path of the configure file.

Inference

Sample molecules for all pockets in the test set

python -u sample_batch.py --ckpt <checkpoint> --num_samples <number of samples> --sampling_type generalized

Sample molecules for given customized pockets

python -u sample_for_pdb.py --ckpt <checkpoint> --pdb_path <pdb path> --num_atom <num atom> --num_samples <number of samples> --sampling_type generalized

num_atom is the number of atoms of generated molecules (It is suggested to be no more than 30 if you use our pretrained model).

Sample novel molecules given seed fragments

python -u sample_frag.py --ckpt <checkpoint> --pdb_path <pdb path> --mol_file <mole file> --keep_index <seed fragments index> --num_atom <num atom> --num_samples <number of samples> --sampling_type generalized

num_atom is the number of atoms of generated fragments. keep_index is the index of the atoms of the seed fragments. You could utilize the following code to visualize the index of your molecule.

from rdkit import Chem
mol = Chem.SDMolSupplier(f)[0]
smiles = Chem.MolToSmiles(mol)
print(smiles)
mol.RemoveAllConformers()
for i, atom in enumerate(mol.GetAtoms()):
    atom.SetProp('molAtomMapNumber', str(i))
Draw.MolToImage(mol, size=(1000,1000))

For example, you could set keep index as 4 5 10 11 12 13 14 for the following molecule to generate novel molecules based on the desired fragment.

Here is an example command

python -u sample_frag.py --ckpt 500.pt --pdb_path data/2VUKcut10/2VUKcut10_pocket.pdb --mol_file data/2VUKcut10/2VUKcut10_ligand.sdf --keep_index 4 5 10 11 12 13 14 --num_atom 18 --num_samples 20 --sampling_type generalized

The reference generated molecule is shown as follows: sample_frag

Sample novel molecules for linker

python -u sample_linker.py --ckpt <checkpoint> --pdb_path <pdb path> --mol_file <mole file> --keep_index <seed fragments index> --num_atom <num atom> --num_samples <number of samples> --sampling_type generalized

num_atom is the number of atoms of generated fragments. mask is the index of the linker that you would like to replace in the original molecule. For example, you could mask 5 6 7 8 9 10 to generate new linkers.

Here is an example command

python -u sample_linker.py --ckpt 500.pt --pdb_path data/3wzecut10/3wzecut10_pocket.pdb --mol_file data/3wzecut10/3wzecut10_ligand.sdf --mask 5 6 7 8 9 10 --num_atom 4 --num_samples 1 --sampling_type generalized --batch_size 1 -build_method reconstruct

The reference generated molecule is shown as follows: sample_linker

Metrics

Evaluate the batch of generated molecules (You need to turn on the save_results arguments in sample* scripts)

python -u evaluate --path <molecule_path>

If you want to evaluate a single molecule, use evaluate_single.py.

QuickVina2

First, convert all protein PDB files to PDBQT files using adt envrionment.

conda activate adt
prepare_receptor4.py -r {} -o {}
cd evaluation

Then, compute QuickVina scores:

conda deactivate
conda activate mol
python docking_2_single.py --receptor_file <prepapre_receptor4_outdir> --sdf_file <sdf file> --out_dir <qvina_outdir>

!!! You have to replace the path of your own mol and adt environment paths with the path in the scripts already.

Citation

@article{huang2024dual,
  title={A dual diffusion model enables 3D molecule generation and lead optimization based on target pockets},
  author={Huang, Lei and Xu, Tingyang and Yu, Yang and Zhao, Peilin and Chen, Xingjian and Han, Jing and Xie, Zhi and Li, Hailong and Zhong, Wenge and Wong, Ka-Chun and others},
  journal={Nature Communications},
  volume={15},
  number={1},
  pages={2657},
  year={2024},
  publisher={Nature Publishing Group UK London}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages