Draft
[WIP]add RFantibody #2456
chendanyangAdd on Dec 12, 2025
[WIP]add RFantibody #2456
Draft
chendanyangAdd on Dec 12, 2025
Total: 8 files changed+589-0
@@ -398,6 +398,7 @@
398"mindscience/MindSPONGE/applications/rf_diffusion/run_inference.py" "no-value-for-parameter"398"mindscience/MindSPONGE/applications/rf_diffusion/run_inference.py" "no-value-for-parameter"
399"mindscience/MindSPONGE/applications/rf_diffusion/rfdiffusion/inference/ab_util.py" "missing-function-docstring"399"mindscience/MindSPONGE/applications/rf_diffusion/rfdiffusion/inference/ab_util.py" "missing-function-docstring"
400"mindscience/MindSPONGE/applications/rf_diffusion/run_inference.py" "invalid-name"400"mindscience/MindSPONGE/applications/rf_diffusion/run_inference.py" "invalid-name"
401+"mindscience/MindSPONGE/applications/rf_antibody/chothia2HLT.py" "invalid-name"
401 402 
402# DeepMind AlphaFold3403# DeepMind AlphaFold3
403"mindscience/MindSPONGE/applications/AlphaFold3/alphafold3/constants/chemical_components.py" "bad-whitespace"404"mindscience/MindSPONGE/applications/AlphaFold3/alphafold3/constants/chemical_components.py" "bad-whitespace"
@@ -63,6 +63,7 @@ MindSpore SPONGE(Simulation Package tOwards Next GEneration molecular modelling)
63- 🔥AlphaFold3 [[Available]](./applications/AlphaFold3)63- 🔥AlphaFold3 [[Available]](./applications/AlphaFold3)
64- 🔥Protenix `In Progress`64- 🔥Protenix `In Progress`
65- 🔥RFdiffusion [[Available]](./applications/rf_diffusion)65- 🔥RFdiffusion [[Available]](./applications/rf_diffusion)
66+- 🔥RFantibody [[Available]](./applications/rf_antibody)
66- Alphafold-Multimer [[Available]](https://gitee.com/mindspore/mindscience/blob/legacy-master/MindSPONGE/applications/model_cards/afmultimer.md)67- Alphafold-Multimer [[Available]](https://gitee.com/mindspore/mindscience/blob/legacy-master/MindSPONGE/applications/model_cards/afmultimer.md)
67- MEGAProtein [[Available]](https://gitee.com/mindspore/mindscience/blob/legacy-master/MindSPONGE/applications/model_cards/MEGAProtein.md)68- MEGAProtein [[Available]](https://gitee.com/mindspore/mindscience/blob/legacy-master/MindSPONGE/applications/model_cards/MEGAProtein.md)
68- FAAST & RASP [[Available]](https://gitee.com/mindspore/mindscience/tree/legacy-master/MindSPONGE/applications/research/FAAST)69- FAAST & RASP [[Available]](https://gitee.com/mindspore/mindscience/tree/legacy-master/MindSPONGE/applications/research/FAAST)
@@ -62,6 +62,7 @@ MindSpore SPONGE (Simulation Package tOwards Next GEneration molecular modelling
62- 🔥AlphaFold3 [[Available]](./applications/AlphaFold3)62- 🔥AlphaFold3 [[Available]](./applications/AlphaFold3)
63- 🔥Protenix `In Progress`63- 🔥Protenix `In Progress`
64- 🔥RFdiffusion [[Available]](./applications/rf_diffusion)64- 🔥RFdiffusion [[Available]](./applications/rf_diffusion)
65+- 🔥RFantibody [[Available]](./applications/rf_antibody)
65- Alphafold-Multimer [[Available]](https://gitee.com/mindspore/mindscience/blob/legacy-master/MindSPONGE/applications/model_cards/afmultimer.md)66- Alphafold-Multimer [[Available]](https://gitee.com/mindspore/mindscience/blob/legacy-master/MindSPONGE/applications/model_cards/afmultimer.md)
66- MEGAProtein [[Available]](https://gitee.com/mindspore/mindscience/blob/legacy-master/MindSPONGE/applications/model_cards/MEGAProtein.md)67- MEGAProtein [[Available]](https://gitee.com/mindspore/mindscience/blob/legacy-master/MindSPONGE/applications/model_cards/MEGAProtein.md)
67- FAAST & RASP [[Available]](https://gitee.com/mindspore/mindscience/tree/legacy-master/MindSPONGE/applications/research/FAAST)68- FAAST & RASP [[Available]](https://gitee.com/mindspore/mindscience/tree/legacy-master/MindSPONGE/applications/research/FAAST)
@@ -0,0 +1,4 @@
1+RFantibody
2+ 
3+This repository includes code from https://github.com/RosettaCommons/RFantibody
4+licensed under the MIT License.
@@ -0,0 +1,168 @@
1+# RFantibody
2+ 
3+## 基于结构的从头抗体设计
4+ 
5+![](./img/cover.png)
6+ 
7+# 说明
8+ 
9+RFantibody 是一个用于基于结构的从头设计抗体与纳米抗体的管线。RFantibody 包含三个步骤:
10+ 
11+- 使用抗体微调版本的 [RFdiffusion](https://www.nature.com/articles/s41586-023-06415-8) 进行蛋白主链设计
12+- 使用 [ProteinMPNN](https://www.science.org/doi/10.1126/science.add2187) 进行蛋白序列设计
13+- 使用 [Protenix](https://www.biorxiv.org/content/10.1101/2025.01.08.631967v1)(字节跳动的 AlphaFold3 实现)对设计进行计算筛选,源于在 RFantibody 论文中 AF3 被报告更有效地进行筛选
14+ 
15+RFantibody 管线的详细描述参见 [预印本](https://www.biorxiv.org/content/10.1101/2024.03.14.585103v1)。
16+ 
17+# 快速开始 / 安装
18+ 
19+由于 RFantibody 由三个方法组成,需要分别遵循它们的安装说明。开始使用 RFantibody 前,请先根据 [RFdiffusion](../rf_diffusion/)、[ProteinMPNN](../protein_mpnn/) 和 [Protenix](../protenix/) 的说明安装依赖并下载权重。
20+ 
21+# 使用
22+ 
23+## HLT 文件格式
24+ 
25+我们需要在 RFantibody 的不同步骤之间传递结构信息。每一步都必须知道:
26+ 
27+- 当前要设计的抗体-靶蛋白复合物结构
28+- 哪条链是重链(Heavy)、轻链(Light)与靶链(Target)
29+- 哪些残基属于各个 CDR 环
30+ 
31+为在管线步骤之间传递这些信息,我们定义了 HLT 文件格式。HLT 文件本质上是一个 .pdb 文件,但有以下约定:
32+ 
33+- 重链使用链 ID `H`
34+- 轻链使用链 ID `L`
35+- 靶链(即使有多条)使用链 ID `T`
36+- 文件中的链顺序依次为重链、轻链、靶链
37+- 文件末尾包含 PDB Remark,标注每个 CDR 环的 1 起始绝对残基索引(非逐链)。例如:
38+ 
39+```text
40+REMARK PDBinfo-LABEL: 32 H1
41+REMARK PDBinfo-LABEL: 52 H2
42+```
43+ 
44+## 输入准备
45+ 
46+RFantibody 中的抗体微调版 RFdiffusion 需要带 HLT Remark 的框架结构作为输入。我们提供了转换脚本,可按如下方式运行:
47+ 
48+```bash
49+python chothia_to_HLT.py -inpdb mychothia.pdb -outpdb myHLT.pdb
50+```
51+ 
52+该脚本需要 Chothia 注释的 .pdb 文件。获取这类文件的一个优质来源是 [SabDab](https://opig.stats.ox.ac.uk/webapps/sabdab-sabpred/sabdab),它定期更新 PDB 中所有抗体和纳米抗体的 Chothia 注释结构。
53+ 
54+我们提供了在 RFantibody 预印本的设计活动中使用的 HLT 格式抗体与纳米抗体框架:
55+ 
56+```text
57+Nanobody Framework: ../rf_diffusion/examples/antibody_pdbs/h-NbBCII10.pdb
58+ScFv Framework: ../rf_diffusion/examples/antibody_pdbs/hu-4D5-8_Fv.pdb
59+```
60+ 
61+## RFdiffusion
62+ 
63+RFantibody 的第一步是使用抗体微调版本的 RFdiffusion 生成抗体-靶标的对接。如下是一个运行 RFdiffusion 的示例命令:
64+ 
65+```bash
66+python ../rf_diffusion/run_inference.py \
67+ --config-name antibody \
68+ antibody.target_pdb=../rf_diffusion/examples/antibody_pdbs/rsv_site3.pdb \
69+ antibody.framework_pdb=../rf_diffusion/examples/antibody_pdbs/hu-4D5-8_Fv.pdb \
70+ inference.ckpt_override_path=../rf_diffusion/models/RFdiffusion_Ab.ckpt \
71+ 'ppi.hotspot_res=[T305,T456]' \
72+ 'antibody.design_loops=[L1:8-13,L2:7,L3:9-11,H1:7,H2:6,H3:5-13]' \
73+ inference.num_designs=20 \
74+ inference.output_prefix=./rf_diffusion_output
75+```
76+ 
77+命令参数说明:
78+ 
79+- `antibody.target_pdb`:希望设计抗体的目标结构路径。为降低计算开销,通常使用裁剪后的目标结构。裁剪策略详见 [裁剪靶蛋白](#裁剪靶蛋白)。
80+- `antibody.framework_pdb`:希望使用的 HLT 格式抗体框架路径。RFdiffusion 仅对标注为环的区域进行结构与序列设计,这允许我们在已优化的框架上设计对接与环。
81+- `inference.ckpt_override_path`:推理时使用的 RFdiffusion 模型权重路径。
82+- `ppi.hotspot_res`:定义表位的热点残基列表,格式与原版 RFdiffusion 一致。关于热点选择的更多内容见 [选择靶位点](#选择靶位点)。
83+- `antibody.design_loops`:将每个 CDR 环映射到允许的长度范围。各环长度从该范围均匀采样,且彼此独立。如果某 CDR 环存在于框架中但未在字典中出现,则该环的序列与结构在设计中保持不变;如果某 CDR 环被包含但未提供长度范围,则该环在设计时仅使用框架结构中的长度进行序列与结构设计。
84+- `inference.num_designs`:生成设计的数量。
85+- `inference.output_prefix`:输出 .pdb 文件的前缀。
86+ 
87+我们提供了带示例输入的命令,运行方式如下:
88+ 
89+```bash
90+bash /home/scripts/examples/rfdiffusion/antibody_pdbdesign.sh
91+```
92+ 
93+## ProteinMPNN
94+ 
95+RFantibody 的第二步是将 RFdiffusion 生成的对接结果中各 CDR 环分配序列。我们使用基础版本的 ProteinMPNN(即未进行抗体微调的模型)。为方便使用,本仓库打包了所需脚本并提供了封装脚本,仅对 CDR 环进行设计。
96+ 
97+最简运行方式是对一个包含 HLT 格式 .pdb 文件的目录运行:
98+ 
99+```bash
100+python ../proteinmpnn/proteinmpnn_interface_design.py \
101+ -pdbdir ./rf_diffusion_output \
102+ -outpdbdir ./proteinmpnn_output
103+```
104+ 
105+这将对所有 CDR 环进行序列设计,并为每个输入结构提供一个序列。更多参数可通过以下命令查看说明:
106+ 
107+```bash
108+python ../proteinmpnn/proteinmpnn_interface_design.py --help
109+```
110+ 
111+我们也提供了带示例输入的命令,运行方式如下:
112+ 
113+```bash
114+bash ../proteinmpnn/examples/ab_pdb_example.sh
115+```
116+ 
117+## Protenix
118+ 
119+RFantibody 的最后一步是使用 Protenix 预测刚设计的序列结构,然后评估 Protenix 是否认为该序列能够按我们设计的方式结合。
120+ 
121+最简运行方式:
122+ 
123+```bash
124+python run_protenix.py
125+```
126+ 
127+默认情况下将运行 10 次 recycle,并在提供热点的条件下进行 200 步扩散。
128+ 
129+我们提供了带示例输入的命令,运行方式如下:
130+ 
131+```bash
132+bash protenix.sh
133+```
134+ 
135+# 抗体设计的实用注意事项
136+ 
137+抗体设计与从头结合体设计相似,但仍处于较早阶段。这里我们分享如何最好地使用该管线以设计在实验上可行的抗体的建议与经验。随着更多抗体设计活动的开展与最佳实践的形成,我们预计部分建议会更新。本节有若干内容参考自 RFdiffusion README,两者具有许多相似之处,建议适用于二者。
138+ 
139+## 选择靶位点
140+ 
141+并非目标蛋白上的每个位点都适合进行抗体设计。一个更具吸引力的结合位点通常应当包含不少于约 3 个疏水残基以供结合体相互作用。对带电极性位点的结合仍然较难。对于邻近糖基的位点也较难,因为糖基常在结合时变得有序,从而引入不利的能量项。针对无结构环的结合历来较难,但[这篇论文](https://www.nature.com/articles/s41586-023-06953-1)提供了使用 RFdiffusion 结合无结构肽段的策略,该策略与无结构环有许多共通之处;在抗体上使用该策略是可行的,但具体取决于环的柔性,为使环在结合时有序化会付出能量代价。
142+ 
143+## 纳米抗体对接
144+ 
145+在查看纳米抗体输出时,你可能会注意到很多结果呈现“侧向对接”的结合方式。这并不是错误,而是模型在自然的纳米抗体对接数据上训练的结果,纳米抗体常以这种侧向方式结合并形成部分框架介导的接触。你可以通过调节热点与 CDR 长度来获得更接近常规抗体的对接,但如果你更希望得到常规抗体样式的对接,我们建议使用抗体框架进行设计。
146+ 
147+## 裁剪靶蛋白
148+ 
149+RFdiffusion 的运行时间尺度为 O(N^2),其中 N 为体系的残基数。因此,裁剪大型目标以避免不必要的计算代价是很有必要的。RFantibody 管线的所有步骤都支持裁剪后的目标。裁剪是一门艺术:对于某些目标(如多结构域的胞外膜蛋白),一个自然的裁剪点是两个结构域之间的柔性连接处;对于其他蛋白(如病毒刺突蛋白),裁剪点就不那么明显了。通常你需要尽量保留二级结构并尽可能少地引入链断裂,同时在预期结合位点的两侧各保留约 10Å 的靶蛋白。我们建议使用 PyMol 来裁剪靶蛋白。
150+ 
151+## 选取热点
152+ 
153+热点是我们整合到模型中的一个特性,用于控制抗体将与靶标上的哪个位点发生相互作用。在训练期间,如果一个靶残基到最接近的 5 个抗体 CDR 残基的平均 Cβ 距离小于 8Å,我们将其分类为热点。在识别到的所有热点中,实际提供给模型的比例为 0–100%,其余将被掩蔽。我们发现,相比原版 RFdiffusion,RFantibody 对具体选择哪些热点更加敏感:原版 RFdiffusion 在给出不佳热点时倾向于生成长螺旋,而 RFantibody 则通常会生成未对接的抗体。因此,在生成成千上万的设计之前,运行若干试验以确保提供的热点数量能得到你满意的结果,是一个非常好的实践。
154+ 
155+## 设计规模
156+ 
157+在我们论文中报告的某些目标设计活动中,我们曾在 95 个设计中识别到 VHH 结合体。然而,在更一般的情况下,我们预计需要在 1 万量级的设计活动中才能识别到命中。这在很大程度上是由于缺少可靠的筛选指标(在[筛选策略](#筛选策略)一节中有进一步讨论)。所有数据(包括阳性与阴性)都对调优与评估筛选器有益;如果你进行了设计活动并愿意与更广泛的社区分享数据,将对迈向更可靠的筛选器、更高成功率与更低成本的设计活动非常有帮助。
158+ 
159+## 选择 CDR 长度
160+ 
161+我们在设计活动中使用的各环长度范围已在 RFdiffusion 的示例文件中提供。我们通过查看各环的自然长度分布并尽量覆盖其主要密度来确定这些范围。我们也倾向于选择相对较短的 H3 环,因为我们认为它们更容易设计与预测,同时仍提供足够的长度以实现有效结合。对于某些目标(例如针对蛋白中的疏水口袋),较长的 H3 环可能更有用;在这些情况下,应将 H3 的长度范围扩大到超出示例中提供的范围。
162+ 
163+## 筛选策略
164+ 
165+我们建议使用 Protenix 的 ipTM 与 RMSD 指标进行筛选;然而,目前缺乏有效的筛选器,仍是 RFantibody 管线的主要限制。
166+ 
167+> 改编自 [RFantibody](https://github.com/RosettaCommons/RFantibody)
168+> 原始许可协议:MIT License
@@ -0,0 +1,168 @@
1+# RFantibody
2+ 
3+## Structure-Based _de novo_ Antibody Design
4+ 
5+![](./img/cover.png)
6+ 
7+# Description
8+ 
9+RFantibody is a pipeline for the structure-based design of _de novo_ antibodies and nanobodies. RFantibody consists of three separate methods:
10+ 
11+- Protein backbone design with an antibody-fintuned version of [RFdiffusion](https://www.nature.com/articles/s41586-023-06415-8)
12+- Protein sequence design with [ProteinMPNN](https://www.science.org/doi/10.1126/science.add2187)
13+- _In silico_ filtering of designs using [Protenix](https://www.biorxiv.org/content/10.1101/2025.01.08.631967v1) (ByteDance’s AlphaFold3 implementation), chosen because AF3 is reported to screen more effectively in the RFantibody paper.
14+ 
15+The RFantibody pipeline is described in detail in [this preprint](https://www.biorxiv.org/content/10.1101/2024.03.14.585103v1)
16+ 
17+# Getting started / installation
18+ 
19+Since RFantibody is a pipeline that consists of three separate methods, we need to follow the installation instructions for each of these methods. To get started with RFantibody, please first follow the instructions in [RFdiffusion](../rf_diffusion/), [ProteinMPNN](../protein_mpnn/) and [Protenix](../protenix/) to install the required dependencies and download the weights.
20+ 
21+# Usage
22+ 
23+## HLT File Format
24+ 
25+We must pass structures between the different steps of the RFantibody pipeline. Each step of the pipeline must know:
26+ 
27+- The antibody-target complex structure we are currently designing for
28+- Which chain is the Heavy chain, Light chain, and Target chain
29+- Which residues are in which of the CDR loops
30+ 
31+To enable the passing of this information between steps of the pipeline, we define a file format that we call an HLT file. An HLT file is simply a .pdb file but with the following modifications:
32+ 
33+- The Heavy chain is denoted as chain id 'H'
34+- The Light chain is denoted as chain id 'L'
35+- The Target chain(s) are denoted as chain id 'T' (even if there are multiple target chains)
36+- The order of the chains in the file is Heavy then Light then Target
37+- At the end of the file are PDB Remarks indicating the 1-indexed absolute (not per-chain) residue index of each of the CDR loops. For example:
38+ 
39+ ```text
40+ REMARK PDBinfo-LABEL: 32 H1
41+ REMARK PDBinfo-LABEL: 52 H2
42+ ```
43+ 
44+## Input Preparation
45+ 
46+The antibody-finetuned version of RFdiffusion in RFantibody requires an HLT-remarked framework structure as input. We provide a script to perform this conversion that can be run as follows:
47+ 
48+```bash
49+python chothia_to_HLT.py -inpdb mychothia.pdb -outpdb myHLT.pdb
50+```
51+ 
52+This script expects a Chothia annotated .pdb file. A great source for these files is [SabDab](https://opig.stats.ox.ac.uk/webapps/sabdab-sabpred/sabdab), which provides Chothia annotated structures of all antibodies and nanobodies in the PDB and is updated every few months.
53+ 
54+We provide the HLT-formatted antibody and nanobody frameworks that were used in the design campaigns from the RFantibody preprint here:
55+ 
56+```text
57+Nanobody Framework: ../rf_diffusion/examples/antibody_pdbs/h-NbBCII10.pdb
58+ScFv Framework: ../rf_diffusion/examples/antibody_pdbs/hu-4D5-8_Fv.pdb
59+```
60+ 
61+## RFdiffusion
62+ 
63+The first step in RFantibody is to generate antibody-target docks using an antibody-finetuned version of RFdiffusion. Here is an example command that will run RFdiffusion:
64+ 
65+```bash
66+python ../rf_diffusion/run_inference.py \
67+ --config-name antibody \
68+ antibody.target_pdb=../rf_diffusion/examples/antibody_pdbs/rsv_site3.pdb \
69+ antibody.framework_pdb=../rf_diffusion/examples/antibody_pdbs/hu-4D5-8_Fv.pdb \
70+ inference.ckpt_override_path=../rf_diffusion/models/RFdiffusion_Ab.ckpt \
71+ 'ppi.hotspot_res=[T305,T456]' \
72+ 'antibody.design_loops=[L1:8-13,L2:7,L3:9-11,H1:7,H2:6,H3:5-13]' \
73+ inference.num_designs=20 \
74+ inference.output_prefix=./rf_diffusion_output
75+```
76+ 
77+Let's go through this command in more detail to understand what these configs are doing:
78+ 
79+- antibody.target_pdb: A path to the target structure that we wish to design antibodies against. This is commonly a cropped target structure to reduce the computational expense of running the pipeline. Cropping strategies are explained in more depth [here](#truncating-your-target-protein).
80+- antibody.framework_pdb: A path to the HLT-formatted antibody framework that we wish to use for our design. RFdiffusion will only design the structure and sequence of regions of the framework which are annotated as loops, this allows us to design the dock and loops of already optimized frameworks.
81+- inference.ckpt_override_path: The path to the set of RFdiffusion model weights we will use for inference
82+- ppi.hotspot_res: A list of hotspot residues that define our epitope. These are provided in the same format as in vanilla RFdiffusion. We discuss selecting hotspots in more detail [here](#selecting-a-target-site).
83+- antibody.design_loops: A dictionary that maps each CDR loop to a range of allowed loop lengths. The length of each loop is sampled uniformly from this range and is sampled independently of the lengths sampled for other loops. If a CDR loop exists in the framework but is not in the dict, this CDR loop will have its sequence and structure fixed during design. If a CDR loop is included in the dict but no range of lengths is provided, this CDR loop will have its sequence and structure designed but only with the length of the loop that is provided in the framework structure.
84+- inference.num_designs: The number of designs we should generate.
85+- inference.output_prefix: The prefix of the .pdb file outputs that we will generate.
86+ 
87+We provide an example command with example inputs which can be run as follows:
88+ 
89+```bash
90+bash /home/scripts/examples/rfdiffusion/antibody_pdbdesign.sh
91+```
92+ 
93+## ProteinMPNN
94+ 
95+The second step in RFantibody is to take the docks generated by RFdiffusion and assign sequences to the CDR loops. We do this using the base version of ProteinMPNN, ie. not an antibody-finetuned model. For convenience, we package the necessary ProteinMPNN scripts in this repo and provide a wrapper script that enables the design of just the CDR loops using ProteinMPNN.
96+ 
97+At its simplest, ProteinMPNN may be run on a directory of HLT-formatted .pdb files using the following command:
98+ 
99+```bash
100+python ../proteinmpnn/proteinmpnn_interface_design.py \
101+ -pdbdir ./rf_diffusion_output \
102+ -outpdbdir ./proteinmpnn_output
103+```
104+ 
105+This will design all CDR loops and will provide one sequence per input structure. There are many more arguments that may be experimented with and are explained by running:
106+ 
107+```bash
108+python ../proteinmpnn/proteinmpnn_interface_design.py --help
109+```
110+ 
111+We provide an example command with example inputs which can be run as follows:
112+ 
113+```bash
114+bash ../proteinmpnn/examples/ab_pdb_example.sh
115+```
116+ 
117+## Protenix
118+ 
119+The final step of the RFantibody pipeline is to use protenix to predict the structure of the sequences we just designed. We then assess whether protenix is confident that the sequence will bind as we designed.
120+ 
121+At it's simplest, protenix may be run on a .pdb files using the following command:
122+ 
123+```bash
124+python run_protenix.py
125+```
126+ 
127+By default this will run with 10 recycling iterations and 200 steps of diffusion with the hotspot provided.
128+ 
129+We provide an example with example inputs which can be run as follows:
130+ 
131+```bash
132+bash protenix.sh
133+```
134+ 
135+# Practical Considerations for Antibody Design
136+ 
137+Designing antibodies is similar to designing _de novo_ binders but is in an earlier stage of development. Here we share advice and learnings on how best to use this pipeline to design antibodies which will work experimentally. We expect some of this advice to change as more antibody design campaigns are performed and best-practices crystallize. Several of these sections are adapted from the analogous section of the RFdiffusion README as these two methods share many similarities and the advice applies to both.
138+ 
139+## Selecting a Target Site
140+ 
141+Not every site on a target protein is a good candidate for antibody design. For a site to be an attractive candidate for binding it should have >~3 hydrophobic residues for the binder to interact with. Binding to charged polar sites is still quite hard. Binding to sites with glycans close to them is also hard since they often become ordered upon binding and you will take an energetic hit for that. Binding to unstructured loops has historically been hard but [this paper](https://www.nature.com/articles/s41586-023-06953-1) outlines a strategy to use RFdiffusion to bind unstructured peptides which share much in common unstructured loops, using this strategy should work with antibodies but depending on the flexibility of the loop, you will pay an energetic price for ordering the loop during binding.
142+ 
143+## Nanobody Docks
144+ 
145+When you begin looking at your nanobody outputs, you may notice that many are binding in a side-on dock. This is not a bug and is a result of the model being trained on natural nanobody docks which often bind in this side-on docking style and make some framework-mediated contacts. You may be able to tune your hotspots and CDR lengths to get a more antibody-like dock, but we recommend that if you desire an antibody-like dock, then you should design with an antibody framework.
146+ 
147+## Truncating your Target Protein
148+ 
149+RFdiffusion scale in runtime as O(N^2) where N is the number of residues in your system. As such, it is a very good idea to truncate large targets so that your computations are not unnecessarily expensive. All steps in the RFantibody pipeline are designed to allow for a truncated target. Truncating a target is an art. For some targets, such as multidomain extracellular membranes, a natural truncation point is where two domains are joined by a flexible linker. For other proteins, such as virus spike proteins, this truncation point is less obvious. Generally you want to preserve secondary structure and introduce as few chain breaks as possible. You should also try to leave ~10A of target protein on each side of your intended target site. We recommend using PyMol to truncate your target protein.
150+ 
151+## Picking Hotspots
152+ 
153+Hotspots are a feature that we integrated into the model to allow for the control of the site on the target which the antibody will interact with. During training, we classify a target residue as a hotspot if it has an average Cβ distance to the closest 5 antibody CDR residues of less than 8 Angstroms. Of all of the hotspots which are identified on the target 0-100% of these hotspots are actually provided to the model and the rest are masked. We find that RFantibody is more sensitive to exactly which hotspots are selected than vanilla RFdiffusion is. Where RFdiffusion tends to generative long helices when given a bad set of hotspots, RFantibody will generally just generate an undocked antibody if a bad set of hotspots is given. It is a very good idea to run a few pilot runs before generating thousands of designs to make sure the number of hotspots you are providing will give results you like.
154+ 
155+## Antibody Design Scale
156+ 
157+For some of the target campaigns that we report on in our manuscript, we were able to identify VHH binders from a set of 95 designs. In the more general case, however, we expect that design campaigns in the 10k range will be required to identify hits. This is in large part due to the lack of a reliable filtering metric (discussed further in the [Filtering Strategies](#filtering-strategies) section). All data, both positive and negative, is useful for tuning and evaluating filters so if you run a design campaign and wish to share your data with the broader community that would be extremely helpful for moving toward a more reliable filter, higher success rates, and cheaper design campaigns.
158+ 
159+## Choosing CDR Lengths
160+ 
161+The loop ranges that we used for our design campaigns are provided in the RFdiffusion example files. We determined these ranges by looking at the frequency of naturally occurring lengths for each loop and trying to cover most of the density with our range. We also tried to choose relatively short H3 loops, as we figured these would be easier to design and predict while still giving us enough length to bind effectively. There are some targets where having a long H3 may be useful, for instance when targeting a hydrophobic pocket in a protein. In these cases, the H3 range should be increased beyond what we provide in the examples.
162+ 
163+## Filtering Strategies
164+ 
165+We recommend filtering using Protenix ipTM and RMSD however the lack of an effective filter is main limitation of the RFantibody pipeline at the moment.
166+ 
167+> Modified from [RFantibody](https://github.com/RosettaCommons/RFantibody)
168+> Original license: MIT License
@@ -0,0 +1,246 @@
1+"""
2+This script converts antibody PDB files from Chothia format to HLT format.
3+HLT format requirements:
4+- Heavy chain is renamed to chain H
5+- Light chain is renamed to chain L
6+- Target chain(s) are renamed to chain T
7+- Chains are ordered as Heavy, Light, then Target
8+- CDR loops are annotated with REMARK statements at the end of the file
9+"""
10+ 
11+import argparse
12+import numpy as np
13+ 
14+from biotite.structure.io.pdb import PDBFile
15+from biotite.structure import array
16+from biotite.structure import residue_iter
17+ 
18+protein_residues = [
19+ "ALA", "ARG", "ASN", "ASP", "CYS", "GLN", "GLU", "GLY",
20+ "HIS", "ILE", "LEU", "LYS", "MET", "PHE", "PRO", "SER",
21+ "THR", "TRP", "TYR", "VAL"
22+]
23+ 
24+def parse_args():
25+ """Parse command line arguments for the script.
26+
27+ Returns:
28+ argparse.Namespace: Parsed command line arguments containing:
29+ - input_pdb: Path to input PDB file
30+ - heavy: Heavy chain ID in input file
31+ - light: Light chain ID in input file
32+ - target: Comma-separated list of target chain IDs
33+ - output: Optional output file path
34+ """
35+ parser = argparse.ArgumentParser(description='Convert Chothia-formatted PDB to HLT format')
36+ parser.add_argument('input_pdb', help='Input PDB file in Chothia format')
37+ parser.add_argument('--heavy', '-H', help='Heavy chain ID')
38+ parser.add_argument('--light', '-L', help='Light chain ID')
39+ parser.add_argument('--target', '-T', help='Target chain ID(s), comma-separated')
40+ parser.add_argument('--output', '-o', help='Output HLT file path')
41+ parser.add_argument('--whole_fab', '-w', action='store_true', help='Keep entire Fab region')
42+ parser.add_argument('--Hcrop', default=115, help='Chothia residue number to crop to for heavy chain a ' + \
43+ 'reasonable number is between 105 and 115')
44+ parser.add_argument('--Lcrop', default=110, help='Chothia residue number to crop to for light chain a ' + \
45+ 'reasonable number is between 100 and 110')
46+ 
47+ args = parser.parse_args()
48+ 
49+ if not (args.heavy or args.light):
50+ raise ValueError('Either heavy or light chain must be specified')
51+ 
52+ return args
53+ 
54+def get_Fv_ranges():
55+ """Define the residue ranges for each Fv loop according to Chothia numbering scheme.
56+
57+ Returns:
58+ dict: Dictionary mapping Fv names to their residue ranges (start, end) inclusive
59+ """
60+ 
61+ return {
62+ 'H': (1, 102),
63+ 'L': (1, 97)
64+ }
65+ 
66+def get_cdr_ranges():
67+ """Define the residue ranges for each CDR loop according to Chothia numbering scheme.
68+
69+ The Chothia numbering scheme is a standardized way to number antibody residues,
70+ making it possible to identify CDR loops based on residue numbers.
71+
72+ Returns:
73+ dict: Dictionary mapping CDR names to their residue ranges (start, end) inclusive
74+ """
75+ return {
76+ 'H': {
77+ 'H1': (26, 32), # Heavy chain CDR1: residues 26-32
78+ 'H2': (52, 56), # Heavy chain CDR2: residues 52-56
79+ 'H3': (95, 102), # Heavy chain CDR3: residues 95-102
80+ },
81+ 'L': {
82+ 'L1': (24, 34), # Light chain CDR1: residues 24-34
83+ 'L2': (50, 56), # Light chain CDR2: residues 50-56
84+ 'L3': (89, 97), # Light chain CDR3: residues 89-97
85+ },
86+ }
87+ 
88+def convert_to_hlt(
89+ input_pdb,
90+ heavy_chain,
91+ light_chain,
92+ target_chains,
93+ whole_fab,
94+ Hcrop,
95+ Lcrop,
96+):
97+ """Convert a Chothia-formatted PDB file to HLT format.
98+
99+ Args:
100+ input_pdb (str): Path to input PDB file
101+ heavy_chain (str): Chain ID for heavy chain in input file
102+ light_chain (str): Chain ID for light chain in input file
103+ target_chains (list): List of chain IDs for target chains
104+ whole_fab (bool): Whether to keep entire Fab region
105+ Hcrop (int): Chothia residue number to crop to for heavy chain
106+ Lcrop (int): Chothia residue number to crop to for light chain
107+
108+ Returns:
109+ tuple: (biotite.structure.Structure, dict)
110+ - Modified structure in HLT format
111+ - Dictionary mapping CDR names to lists of residue numbers
112+ """
113+ # Read input PDB file using biotite
114+ pdb_file = PDBFile.read(input_pdb)
115+ structure = pdb_file.get_structure(model=1)
116+ 
117+ # Subset the structure to only include protein chains
118+ protein_atom_list = []
119+ for atom in structure:
120+ if atom.res_name in protein_residues:
121+ protein_atom_list.append(atom)
122+ 
123+ structure = array(protein_atom_list)
124+ 
125+ # Initialize new structure for HLT format
126+ atom_list = []
127+ 
128+ # Map original chain IDs to new HLT format chain IDs
129+ chain_mapping = {
130+ heavy_chain: 'H',
131+ light_chain: 'L'
132+ }
133+ for t in target_chains:
134+ chain_mapping[t] = 'T'
135+ 
136+ # Initialize dictionary to track CDR loop residue numbers
137+ # These will be used to generate the REMARK statements
138+ cdr_residues = {
139+ 'H1': [], 'H2': [], 'H3': [],
140+ 'L1': [], 'L2': [], 'L3': []
141+ }
142+ 
143+ # Process chains in HLT order
144+ current_residue = 1 # Track absolute residue numbering (1-indexed)
145+ cdr_ranges = get_cdr_ranges()
146+ 
147+ # Process each chain type in order: H, L, T
148+ residue_counter = 1
149+ 
150+ for chain_id in ['H', 'L', 'T']:
151+ orig_chain = None
152+ if chain_id == 'H':
153+ orig_chain = heavy_chain
154+ elif chain_id == 'L':
155+ orig_chain = light_chain
156+ else: # Handle target chains (can be multiple)
157+ for t in target_chains:
158+ chain_mask = structure.chain_id == t
159+ if np.any(chain_mask):
160+ atoms = structure[chain_mask]
161+ # Rename chain to T
162+ atoms.chain_id = np.full(len(atoms), chain_id)
163+ atom_list += atoms
164+ # Update residue counter
165+ # TODO replace this unique with biotite's num residues function
166+ current_residue += len(np.unique(atoms.res_id))
167+ continue
168+ 
169+ # Get atoms for current chain
170+ chain_mask = structure.chain_id == orig_chain
171+ if not np.any(chain_mask):
172+ continue
173+ 
174+ atoms = structure[chain_mask]
175+ # Rename chain to H or L
176+ atoms.chain_id = np.full(len(atoms), chain_id)
177+ 
178+ # Renumber residues to absolute numbering and identify CDR loop residues
179+ if chain_id in cdr_ranges:
180+ 
181+ curr_ranges = cdr_ranges[chain_id]
182+ for residue in residue_iter(atoms):
183+ auth_res_num = np.unique(residue.res_id)[0]
184+ 
185+ if not whole_fab:
186+ if chain_id == 'H' and auth_res_num > Hcrop:
187+ continue
188+ if chain_id == 'L' and auth_res_num > Lcrop:
189+ continue
190+ 
191+ for cdr, (start, end) in curr_ranges.items():
192+ # Only process CDRs matching current chain
193+ if start <= auth_res_num <= end:
194+ # Convert to absolute residue number and store
195+ cdr_residues[cdr].append(residue_counter)
196+ 
197+ # Assign the residue a new residue number
198+ residue.res_id = np.full(len(residue), residue_counter)
199+ 
200+ # Remove insertion codes
201+ residue.ins_code = np.full(len(residue), '')
202+ 
203+ atom_list += residue
204+ 
205+ residue_counter += 1
206+ 
207+ return array(atom_list), cdr_residues
208+ 
209+def main():
210+ """
211+ Main function to run the conversion process
212+ """
213+ 
214+ # Parse command line arguments
215+ args = parse_args()
216+ target_chains = args.target.split(',') if args.target else []
217+ 
218+ # Generate output path if not specified
219+ output_path = args.output or args.input_pdb.replace('.pdb', '_HLT.pdb')
220+ 
221+ # Convert structure to HLT format
222+ hlt_structure, cdr_residues = convert_to_hlt(
223+ args.input_pdb,
224+ args.heavy,
225+ args.light,
226+ target_chains,
227+ args.whole_fab,
228+ args.Hcrop,
229+ args.Lcrop
230+ )
231+ 
232+ # Create new PDB file with converted structure
233+ pdb_file = PDBFile()
234+ pdb_file.set_structure(hlt_structure)
235+ 
236+ # Write structure and CDR annotations
237+ with open(output_path, 'w', encoding='utf-8') as f:
238+ pdb_file.write(f)
239+ # Add CDR annotations as REMARK statements
240+ # Format: REMARK PDBinfo-LABEL: <residue_number> <CDR_name>
241+ for cdr in sorted(cdr_residues.keys()):
242+ for res_num in sorted(cdr_residues[cdr]):
243+ f.write(f"REMARK PDBinfo-LABEL: {res_num:4d} {cdr}\n")
244+ 
245+if __name__ == '__main__':
246+ main()