Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[ICML2025] Zero-Shot Cyclic Peptide Design with Composable Geometric Conditions

Codebase is complete but readme is under construction. Directly contact us if you are in hurry to use our codebase.

Setup

Environment

The conda environment can be constructed with the configuration env.yaml:

conda env create -f env.yaml

The codes are tested with cuda version 12.4 and pytorch version 1.13.1.

Don't forget to activate the environment before running the codes:

conda activate Composer

Quick Start(Inference Only)

We offer you a convenient and direct way to generate peptide using the ckpt we provided in ./checkpoint.

First we should set the condition we want to use:

export condition={CONDITION}

Here, CONDITION should be a number: 1: Stapled peptide 2: Head-to-tail peptide 3: Disulfide peptide 4: Bicycle peptide

After that, run the following command:

python generate.py --config ./configs/pepbench/test_prompt_codesign.yaml --ckpt ./ckpts/LDM_codesign/version_325/checkpoint/epoch37_step85234.ckpt --gpu ${GPU_index}$ --save_dir ./results/${FOLDER NAME}

You will get the linear peptide meeting with geometric constraints. You can use the ./evaluate_utils/success_utils.ipynb to filter the peptide that meet the geometric requirements.

The last step, please find the corresponding file in relaxer folder to transfer the generated linear peptide into the cyclic peptide. You need to specify the acid amoid index to generate the cyclic structure.

relaxer/
│   ├── base.py
│   ├── bicycle.py
│   ├── cys_to_cys.py
│   ├── k_to_de.py
│   ├── head_tail.py 

Training from scratch

Datasets

These datasets are only used for benchmarking models. If you just want to use the trained weights for inferencing on your cases, there is no need to download these datasets.

PepBench

  1. Download

The datasets, which are originally introduced in this paper, are uploaded to Zenodo at this url. You can download them as follows:

mkdir datasets  # all datasets will be put into this directory
wget https://zenodo.org/records/13373108/files/train_valid.tar.gz?download=1 -O ./datasets/train_valid.tar.gz   # training/validation
wget https://zenodo.org/records/13373108/files/LNR.tar.gz?download=1 -O ./datasets/LNR.tar.gz   # test set
wget https://zenodo.org/records/13373108/files/ProtFrag.tar.gz?download=1 -O ./datasets/ProtFrag.tar.gz     # augmentation dataset
  1. Decompresss
tar zxvf ./datasets/train_valid.tar.gz -C ./datasets
tar zxvf ./datasets/LNR.tar.gz -C ./datasets
tar zxvf ./datasets/ProtFrag.tar.gz -C ./datasets
  1. Process
python -m scripts.data_process.process --index ./datasets/train_valid/all.txt  --out_dir ./datasets/train_valid/processed  # train/validation set
python -m scripts.data_process.process --index ./datasets/LNR/test.txt  --out_dir ./datasets/LNR/processed  # test set
python -m scripts.data_process.process --index ./datasets/ProtFrag/all.txt --out_dir ./datasets/ProtFrag/processed # augmentation dataset

The index of processed data for train/validation splits need to be generated as follows, which will result in datasets/train_valid/processed/train_index.txt and datasets/train_valid/processed/valid_index.txt:

python -m scripts.data_process.split --train_index datasets/train_valid/train.txt --valid_index datasets/train_valid/valid.txt --processed_dir datasets/train_valid/processed/

Model Training

Each task requires the following steps:

  1. Train autoencoder
  2. Train latent diffusion model
  3. Calculate distribution of latent distances between consecutive residues
  4. Generation & Evaluation

Load the pre-trained autoencoder

The pre-trained autoencoder is located at the ./checkpoints/autoencoder.pth. The weights are directly adopted from paper Full-atom peptide design with geometric latent diffusion.

Train latent diffusion model

GPU="0" bash scripts/train.sh ./configs/pepbench/prompt_finetune/train_codesign.yaml

Calculate distribution of latent distances between consecutive residues

python setup_latent_guidance.py \
--config ./configs/pepbench/prompt_finetune/setup_latent_guidance.yaml \
--ckpt ${CKPT_PATH} 

Contact

Thank you for your interest in our work!

Please let us know if you have any questions:

Citations

@misc{jiang2025zeroshot,
    title={Zero-Shot Cyclic Peptide Design with Composable Geometric Conditions},
    author={Dapeng Jiang and Xiangzhe Kong and Jiaqi Han and Mingyu Li and Rui Jiao and Wenbing Huang and Stefano Ermon and Jianzhu Ma and Yang Liu},
    year={2025},
    eprint={2507.04225},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

About

Official implementation of CP-Composer. It is the released code of 《Zero-Shot Cyclic Peptide Design via Composable Geometric Constraints》, which has been accepted to ICML2025.

Resources

Stars

31 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages