--- frameworks: - PyTorch language: - en license: mit tags: - OneScience - bioscience - protein-design - binder-design - ProteinMPNN - AlphaFold2 - PyRosetta tasks: - protein-design ---
dl_binder_design
# Model Introduction `dl_binder_design` is a de novo protein binder design pipeline introduced by Bennett et al. It takes a binder-target complex backbone as input, uses ProteinMPNN to design binder sequences, optionally optimizes the structure with PyRosetta FastRelax, and then evaluates the designed complex using an AlphaFold2 implementation modified to support an initial structural guess. The AlphaFold2 stage outputs confidence and structural consistency metrics including pLDDT, PAE, interaction PAE, and RMSD. Paper: [Improving de novo protein binder design with deep learning](https://www.nature.com/articles/s41467-023-38328-5) # Model Description This package is not a single neural network. It is a composite inference pipeline consisting of multiple pretrained models and structural modeling tools: ```text Binder-target complex backbone (PDB / Rosetta silent file) │ ├── ProteinMPNN │ └── Designs binder amino acid sequences │ ├── PyRosetta FastRelax │ └── Optimizes the complex structure (optional) │ └── AlphaFold2 initial guess └── Re-predicts the complex and reports pLDDT, PAE, interaction PAE, and RMSD ``` This workflow does not generate a binder backbone directly from a target structure. The input binder-target backbone can be generated beforehand using tools such as RFdiffusion or provided directly as a PDB or Rosetta silent structure. Example structures are included in this Hugging Face model package. # Use Cases | Use Case | Description | | --- | --- | | Binder sequence design | Generate candidate binder sequences for a given binder-target backbone. | | Sequence and backbone optimization | Alternate ProteinMPNN sequence design with PyRosetta FastRelax. | | Complex structure validation | Use AlphaFold2 with an initial structural guess to re-predict designed complexes. | | Candidate filtering | Rank candidates using pLDDT, PAE, `pae_interaction`, and aligned RMSD. | | Batch processing | Process PDB directories, runlists, checkpoints, and Rosetta silent files. | # Usage ## 1. OneCode You can use the OneCode online environment for an intelligent one-click AI4S programming experience: [Try OneCode for AI4S Programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home) ## 2. Manual Installation ### Hardware Requirements - ProteinMPNN supports CPU execution and accelerator devices visible to PyTorch; - PyRosetta FastRelax mainly runs on CPU, and a high-performance multi-core CPU is recommended; - FastRelax runtime depends on structure length, number of designs, and `relax_cycles`; - AlphaFold2 memory usage and runtime increase with complex length and the number of recycles; - Sufficient disk space is required for the approximately 356 MB `params_model_1_ptm.npz` file, ProteinMPNN weights, PyRosetta installation and database files, as well as generated PDB files, checkpoints, score files, and temporary outputs. ### Download the Model Package Install the Hugging Face command-line tool and download the model repository: ```bash python -m pip install -U huggingface_hub hf download OneScience-Group/dl_binder_design --local-dir ./dl_binder_design cd dl_binder_design ``` ### Install the Runtime Environment **DCU Environment** ```bash # Activate DTK and Conda first conda create -n onescience311 python=3.11 -y conda activate onescience311 python -m pip install onescience[bio-dcu] \ -i http://mirrors.onescience.ai:3141/pypi/simple/ \ --trusted-host mirrors.onescience.ai ``` **GPU Environment** ```bash # Activate Conda first conda create -n onescience311 python=3.11 -y conda activate onescience311 python -m pip install onescience[bio-gpu] \ -i http://mirrors.onescience.ai:3141/pypi/simple/ \ --trusted-host mirrors.onescience.ai ``` Install the additional dependencies required by `dl_binder_design`: ```bash python -m pip install --no-deps -r requirements.txt ``` # Input Requirements The default workflow assumes the following input format: - The first chain is the binder to be designed; - The second chain is the fixed target; - The current AlphaFold2 inference script supports at most two chains; - Different chains should preferably use non-overlapping residue numbering; - If duplicated residue numbers are detected, the adapted script renumbers them by default; - Input structures should contain valid backbone atoms and clearly defined chain boundaries; - Binder residues that must remain unchanged can be marked with the PDB residue label `FIXED`. Example inputs are provided under: ```text conf/examples/inputs/ ``` The example package includes: - 10 PDB binder-target complex backbones; - ProteinMPNN reference outputs; - A Rosetta silent file. # Environment Validation Verify the ProteinMPNN environment: ```bash python model/include/importtests/proteinmpnn_importtest.py ``` Verify the AlphaFold2 environment: ```bash python model/include/importtests/af2_importtest.py ``` # Unified Inference Entry Point ## ProteinMPNN Only **Purpose:** Rapidly design binder sequences for the input complex backbone without running FastRelax. This mode is useful for validating ProteinMPNN checkpoint loading and batch candidate generation. ```bash python scripts/inference.py mpnn \ --input-dir conf/examples/inputs/pdbs \ --output-dir output/mpnn_no_relax \ --relax-cycles 0 \ --seqs-per-struct 1 \ --debug ``` ## ProteinMPNN + FastRelax **Purpose:** Perform sequence design followed by one FastRelax cycle to reduce local structural clashes and optimize the binder-target complex backbone. ```bash python scripts/inference.py mpnn \ --input-dir conf/examples/inputs/pdbs \ --output-dir output/mpnn_fastrelax \ --relax-cycles 1 \ --seqs-per-struct 1 \ --debug ``` ## AlphaFold2 CPU Smoke Test **Purpose:** Re-evaluate a single designed structure using AlphaFold2 with an initial structural guess and output confidence and structural consistency metrics such as pLDDT, PAE, and RMSD. First create a runlist: ```bash mkdir -p output printf '%s\n' 'design_ppi_0_dldesign_0' > output/af2_smoke.list ``` Then run: ```bash python scripts/inference.py af2 \ --input-dir conf/examples/inputs/proteinmpnn_output_pdbs \ --output-dir output/af2_cpu \ --runlist output/af2_smoke.list \ --recycle 1 \ --debug ``` ## Complete PDB Directory Pipeline **Purpose:** Sequentially run sequence design, FastRelax, and AlphaFold2 validation for end-to-end batch generation and evaluation of candidate binders. ```bash python scripts/inference.py pipeline \ --input-dir conf/examples/inputs/pdbs \ --output-dir output/pipeline \ --relax-cycles 1 \ --recycle 1 \ --debug ``` The output includes: - Designed PDB structures; - AlphaFold2-predicted PDB structures; - Checkpoint files; - AlphaFold2 `.sc` score files. A lower `pae_interaction` value generally indicates higher model confidence at the binder-target interface. However, `pae_interaction`, pLDDT, PAE, and related computational metrics do not replace experimental binding validation. # Silent Files and FIXED Residues The unified inference entry point is primarily designed for PDB directories. For Rosetta silent files, the lower-level upstream scripts can be used directly. ProteinMPNN inference on a silent file: ```bash python model/mpnn_fr/dl_interface_design.py \ -silent conf/examples/inputs/in.silent \ -outsilent output/mpnn_fastrelax.silent ``` AlphaFold2 inference on the designed silent structures: ```bash python model/af2_initial_guess/predict.py \ -silent output/mpnn_fastrelax.silent \ -outsilent output/af2.silent \ -scorefilename output/af2.sc ``` ProteinMPNN silent inference performs batch sequence design directly on structures stored in a Rosetta silent file and writes the resulting designs to a new silent file. AlphaFold2 silent inference validates those designed structures and writes both predicted structures and score information. If RFdiffusion also provides `.trb` files, fixed binder positions can be transferred into PDB residue labels: ```bash python model/helper_scripts/addFIXEDlabels.py \ --pdbdir /path/to/pdbs \ --trbdir /path/to/trbs \ --verbose ``` The resulting `FIXED` labels are used to preserve selected binder residues during subsequent sequence design. # Training `dl_binder_design` is an inference orchestration pipeline built around official pretrained ProteinMPNN, PyRosetta, and AlphaFold2 components. This repository does not provide: - An independent trainable `dl_binder_design` model; - A project-level training objective; - A unified optimizer or training loop; - A dedicated training dataset; - A complete retraining entry point. Therefore, this Hugging Face model package does not provide a training command. Retraining ProteinMPNN or AlphaFold2 is a separate upstream model-training workflow and is not part of the standard `dl_binder_design` pipeline. # OneScience Official Resources | 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 - Paper: [Improving de novo protein binder design with deep learning](https://www.nature.com/articles/s41467-023-38328-5) - Upstream `dl_binder_design` implementation: https://github.com/nrbennet/dl_binder_design - ProteinMPNN: https://github.com/dauparas/ProteinMPNN - AlphaFold2: https://github.com/google-deepmind/alphafold The top-level `dl_binder_design` workflow code is distributed under the MIT License. ProteinMPNN source code is also distributed under the MIT License. AlphaFold2 source code is distributed under the Apache License 2.0. Its pretrained model parameters are distributed under separate terms, including CC BY 4.0 attribution requirements. PyRosetta is subject to separate licensing requirements. Commercial use may require an additional license from the PyRosetta/Rosetta developers. All third-party source code, pretrained weights, databases, datasets, and software components remain subject to their respective original licenses, copyright notices, and terms of use. --- # 中文说明 ## 模型简介 `dl_binder_design` 是 Bennett 等人提出的从头蛋白质结合体(binder)设计流程。它以 binder-靶点复合物主链作为输入,使用 ProteinMPNN 设计 binder 序列,可选地使用 PyRosetta FastRelax 优化结构,然后使用经过修改、支持初始结构猜测的 AlphaFold2 实现来评估所设计的复合物。 AlphaFold2 阶段会输出 pLDDT、PAE、相互作用 PAE 和 RMSD 等置信度与结构一致性指标。 论文:[Improving de novo protein binder design with deep learning](https://www.nature.com/articles/s41467-023-38328-5) ## 模型描述 本模型包并非单一的神经网络,而是由多个预训练模型和结构建模工具组成的复合推理(inference)流程: ```text Binder-target complex backbone (PDB / Rosetta silent file) │ ├── ProteinMPNN │ └── Designs binder amino acid sequences │ ├── PyRosetta FastRelax │ └── Optimizes the complex structure (optional) │ └── AlphaFold2 initial guess └── Re-predicts the complex and reports pLDDT, PAE, interaction PAE, and RMSD ``` 该工作流不会直接根据靶点结构生成 binder 主链。 输入的 binder-靶点主链可以预先使用 RFdiffusion 等工具生成,也可以直接以 PDB 或 Rosetta silent 结构的形式提供。本 Hugging Face 模型包中已包含示例结构。 ## 适用场景 | 适用场景 | 描述 | | --- | --- | | binder 序列设计 | 为给定的 binder-靶点主链生成候选 binder 序列。 | | 序列与主链优化 | 交替进行 ProteinMPNN 序列设计与 PyRosetta FastRelax。 | | 复合物结构验证 | 使用带初始结构猜测的 AlphaFold2 对设计出的复合物重新预测。 | | 候选筛选 | 使用 pLDDT、PAE、`pae_interaction` 和对齐后的 RMSD 对候选进行排序。 | | 批量处理 | 处理 PDB 目录、runlist、检查点文件和 Rosetta silent 文件。 | ## 使用方法 ### 1. OneCode 您可以使用 OneCode 在线环境,体验智能一键式 AI4S 编程: [体验 OneCode AI4S 编程](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home) ### 2. 手动安装 #### 硬件要求 - ProteinMPNN 支持 CPU 运行,也支持 PyTorch 可见的加速设备; - PyRosetta FastRelax 主要在 CPU 上运行,建议使用高性能多核 CPU; - FastRelax 的运行时间取决于结构长度、设计数量和 `relax_cycles`; - AlphaFold2 的显存占用和运行时间会随复合物长度和循环(recycle)次数增加; - 需要有足够的磁盘空间存放约 356 MB 的 `params_model_1_ptm.npz` 文件、ProteinMPNN 权重、PyRosetta 安装与数据库文件,以及生成的 PDB 文件、检查点文件、打分文件和临时输出。 #### 下载模型包 安装 Hugging Face 命令行工具并下载模型仓库: ```bash python -m pip install -U huggingface_hub hf download OneScience-Group/dl_binder_design --local-dir ./dl_binder_design cd dl_binder_design ``` #### 安装运行环境 **DCU 环境** ```bash # Activate DTK and Conda first conda create -n onescience311 python=3.11 -y conda activate onescience311 python -m pip install onescience[bio-dcu] \ -i http://mirrors.onescience.ai:3141/pypi/simple/ \ --trusted-host mirrors.onescience.ai ``` **GPU 环境** ```bash # Activate Conda first conda create -n onescience311 python=3.11 -y conda activate onescience311 python -m pip install onescience[bio-gpu] \ -i http://mirrors.onescience.ai:3141/pypi/simple/ \ --trusted-host mirrors.onescience.ai ``` 安装 `dl_binder_design` 所需的额外依赖: ```bash python -m pip install --no-deps -r requirements.txt ``` ## 输入要求 默认工作流假定输入格式如下: - 第一条链是待设计的 binder; - 第二条链是固定的靶点; - 当前的 AlphaFold2 推理脚本最多支持两条链; - 不同链最好使用互不重叠的残基编号; - 如果检测到重复的残基编号,适配后的脚本默认会重新编号; - 输入结构应包含有效的主链原子和清晰定义的链边界; - 需要保持不变的 binder 残基可以用 PDB 残基标签 `FIXED` 标记。 示例输入位于: ```text conf/examples/inputs/ ``` 示例包中包括: - 10 个 PDB binder-靶点复合物主链; - ProteinMPNN 参考输出; - 一个 Rosetta silent 文件。 ## 环境验证 验证 ProteinMPNN 环境: ```bash python model/include/importtests/proteinmpnn_importtest.py ``` 验证 AlphaFold2 环境: ```bash python model/include/importtests/af2_importtest.py ``` ## 统一推理入口 ### 仅使用 ProteinMPNN **目的:** 在不运行 FastRelax 的情况下,为输入的复合物主链快速设计 binder 序列。 该模式适合用于验证 ProteinMPNN 模型权重(检查点)的加载以及批量候选生成。 ```bash python scripts/inference.py mpnn \ --input-dir conf/examples/inputs/pdbs \ --output-dir output/mpnn_no_relax \ --relax-cycles 0 \ --seqs-per-struct 1 \ --debug ``` ### ProteinMPNN + FastRelax **目的:** 先进行序列设计,再执行一轮 FastRelax,以减少局部结构冲突并优化 binder-靶点复合物主链。 ```bash python scripts/inference.py mpnn \ --input-dir conf/examples/inputs/pdbs \ --output-dir output/mpnn_fastrelax \ --relax-cycles 1 \ --seqs-per-struct 1 \ --debug ``` ### AlphaFold2 CPU 冒烟测试 **目的:** 使用带初始结构猜测的 AlphaFold2 重新评估单个设计结构,并输出 pLDDT、PAE、RMSD 等置信度与结构一致性指标。 首先创建一个 runlist: ```bash mkdir -p output printf '%s\n' 'design_ppi_0_dldesign_0' > output/af2_smoke.list ``` 然后运行: ```bash python scripts/inference.py af2 \ --input-dir conf/examples/inputs/proteinmpnn_output_pdbs \ --output-dir output/af2_cpu \ --runlist output/af2_smoke.list \ --recycle 1 \ --debug ``` ### 完整的 PDB 目录流程 **目的:** 依次运行序列设计、FastRelax 和 AlphaFold2 验证,实现候选 binder 的端到端批量生成与评估。 ```bash python scripts/inference.py pipeline \ --input-dir conf/examples/inputs/pdbs \ --output-dir output/pipeline \ --relax-cycles 1 \ --recycle 1 \ --debug ``` 输出包括: - 设计得到的 PDB 结构; - AlphaFold2 预测的 PDB 结构; - 检查点文件; - AlphaFold2 `.sc` 打分文件。 `pae_interaction` 的值越低,通常表示模型对 binder-靶点界面的置信度越高。 但是,`pae_interaction`、pLDDT、PAE 及相关计算指标并不能替代实验上的结合验证。 ## Silent 文件与 FIXED 残基 统一推理入口主要是针对 PDB 目录设计的。 对于 Rosetta silent 文件,可以直接使用更底层的上游脚本。 对 silent 文件执行 ProteinMPNN 推理: ```bash python model/mpnn_fr/dl_interface_design.py \ -silent conf/examples/inputs/in.silent \ -outsilent output/mpnn_fastrelax.silent ``` 对设计出的 silent 结构执行 AlphaFold2 推理: ```bash python model/af2_initial_guess/predict.py \ -silent output/mpnn_fastrelax.silent \ -outsilent output/af2.silent \ -scorefilename output/af2.sc ``` ProteinMPNN silent 推理会直接对 Rosetta silent 文件中存储的结构进行批量序列设计,并将设计结果写入新的 silent 文件。 AlphaFold2 silent 推理会对这些设计出的结构进行验证,并同时写出预测结构和打分信息。 如果 RFdiffusion 还提供了 `.trb` 文件,可以将固定的 binder 位点转移到 PDB 残基标签中: ```bash python model/helper_scripts/addFIXEDlabels.py \ --pdbdir /path/to/pdbs \ --trbdir /path/to/trbs \ --verbose ``` 得到的 `FIXED` 标签用于在后续序列设计中保留选定的 binder 残基。 ## 训练 `dl_binder_design` 是一个围绕官方预训练的 ProteinMPNN、PyRosetta 和 AlphaFold2 组件构建的推理编排流程。 本仓库不提供: - 独立的、可训练的 `dl_binder_design` 模型; - 项目级的训练目标; - 统一的优化器或训练循环; - 专用的训练数据集; - 完整的重新训练入口。 因此,本 Hugging Face 模型包不提供训练命令。 重新训练 ProteinMPNN 或 AlphaFold2 属于独立的上游模型训练流程,不属于标准 `dl_binder_design` 流程的一部分。 ## 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 | ## 引用与许可 - 论文:[Improving de novo protein binder design with deep learning](https://www.nature.com/articles/s41467-023-38328-5) - 上游 `dl_binder_design` 实现:https://github.com/nrbennet/dl_binder_design - ProteinMPNN:https://github.com/dauparas/ProteinMPNN - AlphaFold2:https://github.com/google-deepmind/alphafold 顶层的 `dl_binder_design` 工作流代码以 MIT License 分发。 ProteinMPNN 源代码同样以 MIT License 分发。 AlphaFold2 源代码以 Apache License 2.0 分发。其预训练模型参数按照单独的条款分发,包括 CC BY 4.0 的署名要求。 PyRosetta 受单独的许可要求约束。商业用途可能需要从 PyRosetta/Rosetta 开发者处获取额外许可。 所有第三方源代码、预训练权重、数据库、数据集和软件组件仍然受其各自原始许可证、版权声明和使用条款的约束。