SurfDock
Model Introduction
SurfDock is a surface-informed diffusion generative model for protein–ligand complex prediction and structure-based virtual screening. The model incorporates protein surface geometry and chemical information into the diffusion-based docking process to generate and screen protein–small-molecule binding conformations.
Paper:
SurfDock is a surface-informed diffusion generative model for reliable and accurate protein–ligand complex prediction
Duanhua Cao, Mingan Chen, Rui Zhang, et al.
Nature Methods, 2024
DOI: https://doi.org/10.1038/s41592-024-02516-y
Model Description
SurfDock is a surface-informed diffusion generative model for protein–ligand complex prediction and structure-based virtual screening. The model first preprocesses the target protein structure and computes geometric and physicochemical information on the protein surface. In parallel, it uses ESM to extract protein sequence representations, providing both structural and sequence information for subsequent ligand conformation generation.
During inference, SurfDock uses a diffusion generative model to sample candidate ligand conformations within the protein binding site, and then evaluates and ranks the generated poses using a pose confidence model. For virtual screening tasks, a screening score model can be further applied to rescore candidate protein–ligand conformations, producing results that are better suited for downstream ranking and screening.
By integrating protein surface information, protein language model representations, and diffusion-based conformation generation, SurfDock can be used for protein–ligand docking, candidate binding pose generation, pose scoring, and structure-based virtual screening.
Use Cases
| Use Case | Description |
|---|---|
| Protein–ligand docking | Predict the binding conformation of a ligand within a protein binding site |
| Structure-based virtual screening | Perform batch docking and scoring for small-molecule libraries |
| Ligand conformation generation | Sample candidate binding poses using a diffusion model |
| Protein surface modeling | Use protein surface geometry and physicochemical information to assist docking |
Usage Instructions
1. OneCode Usage
You can use the OneCode online environment for intelligent one-click AI4S programming:
Try intelligent one-click AI4S programming
2. Manual Installation and Usage
Hardware Requirements
- SurfDock involves computationally intensive diffusion sampling, ESM representation extraction, and graph neural network computation. GPU/DCU acceleration is recommended.
Environment Setup
DCU Environment
# Activate DTK and CONDA first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[bio] \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
Environment Notes
- During actual execution, if dependencies are missing or version incompatibilities occur, refer to the dependency versions declared in
environment.yamlin the repository root and install or adjust the corresponding dependencies as needed. - SurfDock's protein surface processing pipeline depends on PyMesh. If the current Python version is not fully compatible with the upstream PyMesh package, compatibility adjustments should be made according to the actual call relationships.
Weights and Data Preparation
SurfDock Model Weights
The current repository already includes the main model weights required for inference:
weight/
├── docking/
│ ├── best_ema_inference_epoch_model.pt
│ └── model_parameters.yml
├── posepredict/
│ ├── best_model.pt
│ └── model_parameters.yml
└── screen/
├── best_model.pt
└── model_parameters.yml
Therefore, after downloading the complete repository, you generally do not need to download the main SurfDock model weights separately.
Check:
ls -lh weight/docking/
ls -lh weight/posepredict/
ls -lh weight/screen/
ESM Model
SurfDock uses ESM to extract protein sequence representations.
Official installation method:
git clone https://github.com/facebookresearch/esm model/esm
cd model/esm
pip install -e .
cd ../..
The official inference script uses:
esm2_t33_650M_UR50D
and runs:
python model/esm/scripts/extract.py \
"esm2_t33_650M_UR50D" \
input.fasta \
output_dir \
--repr_layers 33 \
--include "per_tok" \
--truncation_seq_length 4096
to extract protein residue-level embeddings.
- If the current environment cannot access the internet, it is recommended to cache the corresponding ESM weights in advance.
esm2_t33_650M_UR50Drequires the following two files:
https://dl.fbaipublicfiles.com/fair-esm/models/esm2_t33_650M_UR50D.pt
https://dl.fbaipublicfiles.com/fair-esm/regression/esm2_t33_650M_UR50D-contact-regression.pt
After downloading, it is recommended to place them in the current user's Torch Hub checkpoints cache directory:
~/.cache/torch/hub/checkpoints/
The final file paths should be:
~/.cache/torch/hub/checkpoints/esm2_t33_650M_UR50D.pt
~/.cache/torch/hub/checkpoints/esm2_t33_650M_UR50D-contact-regression.pt
PDBBind Data
If you need to retrain SurfDock, you must obtain PDBBind separately. According to the official instructions, the preprocessed data previously provided by EquiBind is no longer publicly distributed due to PDBBind licensing restrictions, so users need to obtain and process the data themselves through the official PDBBind channels.
After processing, place the data in:
model/data/PDBBind_processed/
model/data/splits/ contains data split information and is not equivalent to the complete PDBBind dataset.
3. Quick Start
Download the Model Package
hf download \
OneScience-Group/SurfDock \
--local-dir ./SurfDock
cd SurfDock
- SurfDock uses ESM to extract protein sequence representations, so the ESM model must be downloaded separately. See the Weights and Data Preparation section for details.
Example Data
The current repository already provides docking and screening examples:
model/data/eval_sample_dirs/
model/data/Screen_sample_dirs/
When using your own data, organize the protein and ligand inputs according to the example directory structure, and modify the following paths in the corresponding bash scripts:
data_dir
surface_out_dir
out_csv_file
Screen_lib_path
docking_out_dir
as needed.
Inference Examples
The following commands are assumed to be executed from the SurfDock repository root directory.
Protein–Ligand Docking Example
Run:
cd scripts/bash_scripts/test_scripts
bash eval_samples.sh
The script mainly performs the following steps automatically:
1. Preprocess the protein structure
2. Compute the protein surface
3. Build the inference input CSV
4. Extract ESM embeddings
5. Run SurfDock diffusion sampling
6. Save docking results
Before running, it is recommended to check:
vim scripts/bash_scripts/test_scripts/eval_samples.sh
Pay particular attention to:
gpu_string
data_dir
surface_out_dir
out_csv_file
esmbedding_dir
docking_out_dir
Users also need to adjust the CUDA_VISIBLE_DEVICES and accelerate launch settings in the script according to the actual adaptation method.
Virtual Screening Example
Run:
cd scripts/bash_scripts/test_scripts
bash screen_pipeline.sh
Before running, check:
vim scripts/bash_scripts/test_scripts/screen_pipeline.sh
Modify the following as needed:
gpu_string
data_dir
surface_out_dir
out_csv_file
esmbedding_dir
Screen_lib_path
docking_out_dir
Here, Screen_lib_path specifies the small-molecule library to be screened, for example the official sample:
model/data/Screen_sample_dirs/test_samples/1a0q/1a0q_ligand_for_Screen.sdf
The screening workflow is mainly:
Protein preprocessing
↓
Protein surface computation
↓
ESM embedding
↓
SurfDock generates candidate conformations
↓
Screen model rescoring
↓
Output screening results
Skip Completed Protein Preprocessing
This parameter can be modified in the following two scripts:
scripts/bash_scripts/test_scripts/eval_samples.sh
scripts/bash_scripts/test_scripts/screen_pipeline.sh
The scripts use:
target_have_processed=true
to control whether target preprocessing is skipped. When set to true, the scripts skip target protein preprocessing steps such as OpenBabel/reduce and proceed directly to subsequent surface computation, CSV construction, ESM embedding, and inference.
To reprocess the target protein:
target_have_processed=false
When set to false, the scripts rerun the target protein preprocessing steps.
Generate ESM Embeddings Separately
First, build the FASTA file:
python model/datasets/esm_embedding_preparation.py \
--out_file ./protein.fasta \
--protein_ligand_csv ./input.csv
Extract ESM representations:
python model/esm/scripts/extract.py \
"esm2_t33_650M_UR50D" \
./protein.fasta \
./esm_embedding_output \
--repr_layers 33 \
--include "per_tok" \
--truncation_seq_length 4096
Extract pocket embeddings:
python model/datasets/get_pocket_embedding.py \
--protein_pocket_csv ./input.csv \
--embeddings_dir ./esm_embedding_output \
--pocket_emb_save_dir ./esm_embedding_pocket_output
Merge them into the .pt file required for SurfDock inference:
python model/datasets/esm_pocket_embeddings_to_pt.py \
--esm_embeddings_path ./esm_embedding_pocket_output \
--output_path ./esm2_pocket_embeddings.pt
Training Instructions
Retraining SurfDock
Retraining requires preparing the PDBBind data first and completing protein surface and ESM embedding preprocessing.
The training-related scripts are located in:
scripts/bash_scripts/train_SurfDock_docking_module/
First, prepare the ESM embedding files required for training by following the "Generate ESM Embeddings Separately" section. The training script in the current repository is located at:
scripts/bash_scripts/train_SurfDock_docking_module/train_SurfDock.sh
After completing the ESM embeddings, check the data, model, and output paths in train_SurfDock.sh, then run:
cd scripts/bash_scripts/train_SurfDock_docking_module
bash train_SurfDock.sh
Retraining SurfScore
The SurfScore training script is located at:
scripts/bash_scripts/train_SurfScore/train_SurfScore.sh
Before running, check the PDBBind data, cache, ESM embedding, output directory, and GPU parameters in the script, then run:
cd scripts/bash_scripts/train_SurfScore
bash train_SurfScore.sh
Output Description
Docking Output
The docking results from eval_samples.sh are saved in the directory specified by docking_out_dir in the script.
The main outputs include:
Generated protein–ligand conformations
Confidence/scoring results
Runtime logs
Intermediate CSV
ESM embeddings
Protein surface files
Screening Output
screen_pipeline.sh generates the screening results in docking_out_dir and uses:
weight/screen/best_model.pt
to rescore the docking poses.
The final results can be used to rank and screen candidate small molecules.
OneScience Official Information
| Platform | OneScience Main Repository | Skills Repository |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
Citation and License
- The official SurfDock source code repository is released under the MIT License, which permits use, modification, distribution, sublicensing, and commercial use. The original copyright notice and MIT License text should be retained when copying or distributing the software.
- PDBBind data is governed by its own license and terms of use. SurfDock's MIT License does not automatically apply to PDBBind data.
- This repository is a DCU-adapted version of SurfDock, with adjustments to parts of the runtime environment, dependency configuration, and execution workflow. The use of the repository code, model weights, and related data remains subject to the licenses and terms of use of their respective original projects.
中文说明
模型简介
SurfDock 是一种利用表面信息的扩散生成模型,用于预测蛋白质–配体复合物及基于结构的虚拟筛选。该模型将蛋白质表面几何与化学信息融入基于扩散的分子对接(molecular docking)过程,以生成并筛选蛋白质–小分子结合构象。
论文
SurfDock 是一种利用表面信息的扩散生成模型,可可靠、准确地预测蛋白质–配体复合物
Duanhua Cao, Mingan Chen, Rui Zhang, et al.
Nature Methods, 2024
DOI: https://doi.org/10.1038/s41592-024-02516-y
模型描述
SurfDock 是一种利用表面信息的扩散生成模型,用于预测蛋白质–配体复合物及基于结构的虚拟筛选。模型先预处理靶蛋白结构,计算蛋白质表面几何及物理化学信息。同时,模型使用 ESM 提取蛋白质序列表征,为后续的配体构象生成提供结构和序列信息。
推理(inference)期间,SurfDock 使用扩散生成模型在蛋白质结合位点内采样候选配体构象,再通过姿势置信度模型评估并排序生成的姿势。在虚拟筛选任务中,可进一步使用筛选评分模型重新为候选蛋白质–配体构象评分,使结果更适合后续排序和筛选。
通过整合蛋白质表面信息、蛋白质语言模型(protein language model)表征和基于扩散的构象生成,SurfDock 可用于蛋白质–配体分子对接、候选结合姿势生成、姿势评分及基于结构的虚拟筛选。
使用场景
| 使用场景 | 说明 |
|---|---|
| 蛋白质–配体分子对接 | 预测蛋白质结合位点内配体的结合构象 |
| 基于结构的虚拟筛选 | 对小分子库进行批量分子对接并评分 |
| 配体构象生成 | 使用扩散模型采样候选结合姿势 |
| 蛋白质表面建模 | 使用蛋白质表面几何和物理化学信息辅助分子对接 |
使用说明
1. OneCode 使用方法
可通过 OneCode 在线环境体验智能一键 AI4S 编程。
2. 手动安装与使用
硬件要求
- SurfDock 涉及计算密集型的扩散采样、ESM 表征提取和图神经网络计算,建议使用 GPU/DCU 加速。
配置环境
DCU 环境
# Activate DTK and CONDA first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[bio] \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
环境说明
- 如果实际运行中出现依赖缺失或版本不兼容,请参考仓库根目录下的
environment.yaml中声明的依赖版本,按需安装或调整相应依赖。 - SurfDock 的蛋白质表面处理流程依赖 PyMesh。如果当前 Python 版本与上游 PyMesh 软件包不完全兼容,应根据实际调用关系进行适配。
权重与数据准备
SurfDock 模型权重
当前仓库已包含推理所需的主要模型权重。
weight/
├── docking/
│ ├── best_ema_inference_epoch_model.pt
│ └── model_parameters.yml
├── posepredict/
│ ├── best_model.pt
│ └── model_parameters.yml
└── screen/
├── best_model.pt
└── model_parameters.yml
因此,下载完整仓库后,通常无需另行下载 SurfDock 主要模型权重。
检查
ls -lh weight/docking/
ls -lh weight/posepredict/
ls -lh weight/screen/
ESM 模型
SurfDock 使用 ESM 提取蛋白质序列表征。
官方安装方法
git clone https://github.com/facebookresearch/esm model/esm
cd model/esm
pip install -e .
cd ../..
官方推理脚本使用
esm2_t33_650M_UR50D
并运行
python model/esm/scripts/extract.py \
"esm2_t33_650M_UR50D" \
input.fasta \
output_dir \
--repr_layers 33 \
--include "per_tok" \
--truncation_seq_length 4096
以提取蛋白质残基层面的嵌入。
- 如果当前环境无法访问互联网,建议提前缓存相应的 ESM 权重。
esm2_t33_650M_UR50D需要以下两个文件。
https://dl.fbaipublicfiles.com/fair-esm/models/esm2_t33_650M_UR50D.pt
https://dl.fbaipublicfiles.com/fair-esm/regression/esm2_t33_650M_UR50D-contact-regression.pt
下载后,建议放在当前用户的 Torch Hub 模型权重(检查点)(checkpoints)缓存目录中。
~/.cache/torch/hub/checkpoints/
最终文件路径应如下所示。
~/.cache/torch/hub/checkpoints/esm2_t33_650M_UR50D.pt
~/.cache/torch/hub/checkpoints/esm2_t33_650M_UR50D-contact-regression.pt
PDBBind 数据
如需重新训练 SurfDock,必须另行获取 PDBBind。根据官方说明,受 PDBBind 许可证限制,EquiBind 先前提供的预处理数据已停止公开分发,用户需通过 PDBBind 官方渠道自行获取并处理数据。
处理后,将数据放在以下位置。
model/data/PDBBind_processed/
model/data/splits/ 包含数据划分信息,不等同于完整的 PDBBind 数据集。
3. 快速开始
下载模型包
hf download \
OneScience-Group/SurfDock \
--local-dir ./SurfDock
cd SurfDock
- SurfDock 使用 ESM 提取蛋白质序列表征,因此必须另行下载 ESM 模型。详见“权重与数据准备”一节。
示例数据
当前仓库已提供分子对接和筛选示例。
model/data/eval_sample_dirs/
model/data/Screen_sample_dirs/
使用自己的数据时,请按示例目录结构组织蛋白质和配体输入,并在相应的 bash 脚本中修改以下路径
data_dir
surface_out_dir
out_csv_file
Screen_lib_path
docking_out_dir
并按需调整。
推理示例
以下命令默认从 SurfDock 仓库根目录执行。
蛋白质–配体分子对接示例
运行以下命令。
cd scripts/bash_scripts/test_scripts
bash eval_samples.sh
脚本自动执行的主要步骤如下。
1. Preprocess the protein structure
2. Compute the protein surface
3. Build the inference input CSV
4. Extract ESM embeddings
5. Run SurfDock diffusion sampling
6. Save docking results
建议在运行前检查以下内容。
vim scripts/bash_scripts/test_scripts/eval_samples.sh
请特别注意以下事项。
gpu_string
data_dir
surface_out_dir
out_csv_file
esmbedding_dir
docking_out_dir
用户还需要根据实际适配方式,调整脚本中的 CUDA_VISIBLE_DEVICES 和 accelerate launch 设置。
虚拟筛选示例
运行以下命令。
cd scripts/bash_scripts/test_scripts
bash screen_pipeline.sh
运行前,检查以下内容。
vim scripts/bash_scripts/test_scripts/screen_pipeline.sh
根据需要修改以下内容。
gpu_string
data_dir
surface_out_dir
out_csv_file
esmbedding_dir
Screen_lib_path
docking_out_dir
其中,Screen_lib_path 指定待筛选的小分子库,例如以下官方样例。
model/data/Screen_sample_dirs/test_samples/1a0q/1a0q_ligand_for_Screen.sdf
筛选流程主要如下。
Protein preprocessing
↓
Protein surface computation
↓
ESM embedding
↓
SurfDock generates candidate conformations
↓
Screen model rescoring
↓
Output screening results
跳过已完成的蛋白质预处理
可在以下两个脚本中修改此参数。
scripts/bash_scripts/test_scripts/eval_samples.sh
scripts/bash_scripts/test_scripts/screen_pipeline.sh
脚本通过
target_have_processed=true
控制是否跳过靶标预处理。设置为 true 时,脚本跳过 OpenBabel/reduce 等靶蛋白预处理步骤,直接进入后续的表面计算、CSV 构建、ESM 嵌入和推理。
如需重新处理靶蛋白,请进行以下设置。
target_have_processed=false
设置为 false 时,脚本重新运行靶蛋白预处理步骤。
单独生成 ESM 嵌入
先构建 FASTA 文件。
python model/datasets/esm_embedding_preparation.py \
--out_file ./protein.fasta \
--protein_ligand_csv ./input.csv
提取 ESM 表征。
python model/esm/scripts/extract.py \
"esm2_t33_650M_UR50D" \
./protein.fasta \
./esm_embedding_output \
--repr_layers 33 \
--include "per_tok" \
--truncation_seq_length 4096
提取口袋嵌入。
python model/datasets/get_pocket_embedding.py \
--protein_pocket_csv ./input.csv \
--embeddings_dir ./esm_embedding_output \
--pocket_emb_save_dir ./esm_embedding_pocket_output
将它们合并为 SurfDock 推理需要的 .pt 文件。
python model/datasets/esm_pocket_embeddings_to_pt.py \
--esm_embeddings_path ./esm_embedding_pocket_output \
--output_path ./esm2_pocket_embeddings.pt
训练说明
重新训练 SurfDock
重新训练前,需要先准备 PDBBind 数据,再完成蛋白质表面及 ESM 嵌入预处理。
训练相关脚本位于以下位置。
scripts/bash_scripts/train_SurfDock_docking_module/
首先,按照“单独生成 ESM 嵌入”一节准备训练所需的 ESM 嵌入文件。当前仓库的训练脚本位于以下位置。
scripts/bash_scripts/train_SurfDock_docking_module/train_SurfDock.sh
完成 ESM 嵌入后,检查 train_SurfDock.sh 中的数据、模型和输出路径,再运行以下命令。
cd scripts/bash_scripts/train_SurfDock_docking_module
bash train_SurfDock.sh
重新训练 SurfScore
SurfScore 训练脚本位于以下位置。
scripts/bash_scripts/train_SurfScore/train_SurfScore.sh
运行前,检查脚本中的 PDBBind 数据、缓存、ESM 嵌入、输出目录和 GPU 参数,再运行以下命令。
cd scripts/bash_scripts/train_SurfScore
bash train_SurfScore.sh
输出说明
分子对接输出
eval_samples.sh 的分子对接结果保存在脚本中 docking_out_dir 指定的目录内。
主要输出包括以下内容。
Generated protein–ligand conformations
Confidence/scoring results
Runtime logs
Intermediate CSV
ESM embeddings
Protein surface files
筛选输出
screen_pipeline.sh 在 docking_out_dir 中生成筛选结果,并使用
weight/screen/best_model.pt
对分子对接姿势重新评分。
最终结果可用于候选小分子的排序和筛选。
OneScience 官方信息
| 平台 | OneScience 主仓库 | Skills 仓库 |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
引用与许可证
- SurfDock 官方源代码仓库按照 MIT 许可证发布,允许使用、修改、分发、再许可及商业使用。复制或分发软件时,应保留原始版权声明与 MIT 许可证文本。
- PDBBind 数据受其自身许可证及使用条款约束。SurfDock 的 MIT 许可证不自动适用于 PDBBind 数据。
- 本仓库是 SurfDock 的 DCU 适配版本,部分运行环境、依赖配置及执行流程经过调整。使用仓库代码、模型权重及相关数据仍须遵守各自原始项目的许可证和使用条款。
- Downloads last month
- 24