RFantibody: Structure-based design of de novo antibodies and nanobodies

RFantibody is a pipeline for structure-based design of de novo antibodies and nanobodies. The pipeline consists of three methods: (1) design of backbone shapes using RFdiffusion, (2) design of sequences that fit those backbones using ProteinMPNN, and (3) prediction of final structures using RF2,

Reference:

Documentation
Important Notes

Interactive job
Interactive jobs should be used for debugging, graphics, or applications that cannot be run as batch jobs.

Allocate an interactive session and copy sample data. Sample session:

[user@biowulf]$ sinteractive --gres=gpu:a100:1
[user@cn0094 ~]$ module load rfantibody
[+] Loading rfantibody  94eb01f  on cn0094
[+] Loading singularity  4.2.2  on cn0094
[user@cn0094 ~]$ cd /data/${USER}
[user@cn0094 ~]$ cp $RFANTIBODY_TEST_DATA/* .
Step 1: RFdiffusion (Designs backbone shapes that bind the antigen and defines structural feasibility of binding)
[user@cn0094 ~]$ rfantibody rfdiffusion \
  --config-name antibody \
  antibody.target_pdb=$(pwd)/rsv_site3.pdb \
  antibody.framework_pdb=$(pwd)/hu-4D5-8_Fv.pdb \
  inference.ckpt_override_path=/opt/RFantibody/weights/RFdiffusion_Ab.pt \
  inference.num_designs=2 \
  inference.output_prefix=$(pwd)/rfdiff_out/test
Container ready. Using /opt/RFantibody as working directory.
Activating RFantibody venv in ./venv
WARNING: You're overriding the checkpoint path from the defaults. Check that the model you're providing can run with the inputs you're providing.
[2025-12-16 12:32:41,781][rfantibody.rfdiffusion.inference.model_runners][INFO] - Reading checkpoint from /opt/RFantibody/weights/RFdiffusion_Ab.pt
This is inf_conf.ckpt_path
/opt/RFantibody/weights/RFdiffusion_Ab.pt
[...]
Monitoring target centering
ic| xyz_t[0,0,self.diffusion_mask,1].mean(dim=0): tensor([ 0.0307, -0.0642, -0.0339], device='cuda:0')
ic| xt_in[0,self.diffusion_mask,1].mean(dim=0): tensor([    -0.0000,      0.0000,     -0.0000], device='cuda:0')
Sequence of Hotspot Residues:
[2025-12-16 12:40:14,487][__main__][INFO] - Finished design in 2.68 minutes
Step 2: ProteinMPNN (Designs sequences that fit backbones generated above to produce realistic antibody sequences)
[user@cn0094 ~]$ rfantibody proteinmpnn \
  -pdbdir $(pwd)/rfdiff_out \
  -outpdbdir $(pwd)/mpnn_out
Container ready. Using /opt/RFantibody as working directory.
Activating RFantibody venv in ./venv
Random seed wil be used
init structmanager
file check.point
outdirlist []
Found GPU will run ProteinMPNN on GPU
The following amino acids will be omitted:  ['C', 'X']
finished set()

[...]
MPNN generated 1 sequences in 1 seconds
sequence_optimize: [('EVQLVESGGGLVQPGGSLRLSCAASGFDFSSTYIHWVRQAPGKGLEWVARIHVGSGETRYADSVKGRFTISADTSKNTAYLQMNSLRAEDTAVYYCSRDLLGNAVWGQGTLVTVSSDIQMTQSPSSLSASVGDRVTITCKTSSEVGDTIAWYQQKPGKAPKLLIYKGTTRAPGVPSRFSGSRSGTDFTLTISSLQPEDFATYYCVDLSTNPIRFGQGTKVEIK', 1.317974)]
prefix test_1_dldesign
[('EVQLVESGGGLVQPGGSLRLSCAASGFDFSSTYIHWVRQAPGKGLEWVARIHVGSGETRYADSVKGRFTISADTSKNTAYLQMNSLRAEDTAVYYCSRDLLGNAVWGQGTLVTVSSDIQMTQSPSSLSASVGDRVTITCKTSSEVGDTIAWYQQKPGKAPKLLIYKGTTRAPGVPSRFSGSRSGTDFTLTISSLQPEDFATYYCVDLSTNPIRFGQGTKVEIK', 1.317974)]
output: mpnn_out/test_1_dldesign_0.pdb
Struct: rfdiff_out/test_1.pdb reported success in 1 seconds
Step 3: RF2 (Predicts final structures and confidence; filters, scores, validates design)
[user@cn0094 ~]$ rfantibody rf2 \
  input.pdb_dir=$(pwd)/mpnn_out \
  output.pdb_dir=$(pwd)/rf2_out
Container ready. Using /opt/RFantibody as working directory.
Activating RFantibody venv in ./venv
Running RF2 with the following configs: {'input': {'pdb': None, 'pdb_dir': 'mpnn_out', 'quiver': None}, 'output': {'pdb_dir': 'rf2_out', 'quiver': None, 'output_intermediates': False}, 'inference': {'num_recycles': 10, 'hotspot_show_proportion': 0.1, 'cautious': True}, 'model': {'model_weights': '/opt/RFantibody/weights/RF2_ab.pt'}, 'model_param': {'n_extra_block': 4, 'n_main_block': 36, 'd_msa': 256, 'd_pair': 128, 'd_templ': 64, 'n_head_msa': 8, 'n_head_pair': 4, 'n_head_templ': 4, 'd_hidden': 32, 'd_hidden_templ': 32, 'd_t1d': 23, 'p_drop': 0.0, 'SE3_param_full': {'num_layers': 1, 'num_channels': 48, 'num_degrees': 2, 'l0_in_features': 32, 'l0_out_features': 32, 'l1_in_features': 2, 'l1_out_features': 2, 'num_edge_features': 32, 'div': 4, 'n_heads': 4}, 'SE3_param_topk': {'num_layers': 1, 'num_channels': 128, 'num_degrees': 2, 'l0_in_features': 64, 'l0_out_features': 64, 'l1_in_features': 2, 'l1_out_features': 2, 'num_edge_features': 64, 'div': 4, 'n_heads': 4}}}
TM-score of target alignment: 0.992
TM-score of framework alignment: 0.982
TM-score of target alignment: 0.990
TM-score of framework alignment: 0.982
TM-score of target alignment: 0.989
TM-score of framework alignment: 0.981

Directory rf2_out created
[...]
End the interactive session:
[user@cn0094 ~]$ exit
salloc.exe: Relinquishing job allocation 46116226
[user@biowulf ~]$

Batch job
Most jobs should be run as batch jobs.

Create a batch input file, e.g. rfantibody.sh:

#!/bin/sh

#SBATCH --cpus-per-task=4
#SBATCH --mem=8g
#SBATCH --gres=gpu:a100:1
#SBATCH -p gpu

module load rfantibody
cd /data/$USER
cp $RFANTIBODY_TEST_DATA/* .

rfantibody rfdiffusion \
  --config-name antibody \
  antibody.target_pdb=$(pwd)/rsv_site3.pdb \
  antibody.framework_pdb=$(pwd)/hu-4D5-8_Fv.pdb \
  inference.ckpt_override_path=/opt/RFantibody/weights/RFdiffusion_Ab.pt \
  inference.num_designs=2 \
  inference.output_prefix=$(pwd)/rfdiff_out/test

rfantibody proteinmpnn \
  -pdbdir $(pwd)/rfdiff_out \
  -outpdbdir $(pwd)/mpnn_out

rfantibody rf2 \
  input.pdb_dir=$(pwd)/mpnn_out \
  output.pdb_dir=$(pwd)/rf2_out

Submit this job using the Slurm sbatch command.

sbatch rfantibody.sh