Structure-Based de novo Antibody Design with Fixes and Docker + Singularity Support
This is a modified and functional fork of RosettaCommons/RFantibody, enhanced for easier use, clean installation via Docker or Singularity, and script compatibility. Done by Orsolya Gereben @ hegelab.org
- Working
Dockerfilewith active Python environment - Patched Python scripts for RFdiffusion, ProteinMPNN, RF2
- Added working examples and corrected file paths
- Quiver-based workflows are not tuned
- Container user write permissions fixed with
--user $(id -u) - Preserved original README as
README.orig.md - Singularity definition file (
singularity.def) added for HPC-compatible container builds
git clone --branch main https://github.com/hegelab/RFantibody.git
cd RFantibody
bash include/download_weights.sh
docker build -t rfantibody .
sudo usermod -aG docker $USER # Only once, then logout/login (restart terminal), but if you do not have sudo permission then leave this out, it worked for me without it
docker run --name rfantibody --gpus all -v $(pwd):/home --memory 10g -it rfantibodybash /opt/RFantibody/include/setup.shThis script:
- Installs dependencies via Poetry
- Installs DGL and Biotite
- Builds the USalign executable
Now you will have a container fully equipped to run the RFantibody pipeline.
To save a fully installed image, while the above created rfantibody container runs start a new terminal and create a new image (rfantibody2) from the fully installed container:
docker commit rfantibody rfantibody2Then you can run a container from this image:
docker run --name rfantibody2 --gpus all -v $(pwd):/home --memory 10g --user $(id -u) -it rfantibody2Optional: Change bash prompt inside container
source /opt/RFantibody/setenv.shsingularity build --fakeroot RFantibody_base.sif singularity.def
singularity shell --nv --no-home -B $(pwd):/opt/RFantibody RFantibody_base.sif
(Singularity)$ cd $HOME
(Singularity)$ bash include/setup_sif.sh
(Singularity)$ exit
singularity run --nv --no-home -B $(pwd):/opt/RFantibody RFantibody_base.sif poetry run python /opt/RFantibody/scripts/rfdiffusion_inference.py ... (please see detailed usage overview/examples below)
to create the framework, input should be a Chothia-formatted pdb, for example:
poetry run python /opt/RFantibody/scripts/util/chothia2HLT.py /opt/RFantibody/scripts/examples/example_inputs/9dpe_chothia.pdb -o /opt/RFantibody/scripts/examples/example_inputs/9dpe_ab_HLT.pdb -H H -L Lto create the target:
poetry run python /opt/RFantibody/scripts/util/chothia2HLT.py /opt/RFantibody/scripts/examples/example_inputs/9dpe_chothia.pdb -o /opt/RFantibody/scripts/examples/example_inputs/9dpe_target_HLT.pdb -T Athere are additional options related to cropping the input, see it with
poetry run python /opt/RFantibody/scripts/util/chothia2HLT.py -hIn the container you can run first the backbone design. There are several parameters, you can see them with
poetry run python /opt/RFantibody/scripts/rfdiffusion_inference.py -hand you can override them. ONLY OVERRIDE, if you know, what you are doing!
Example:
poetry run python /opt/RFantibody/scripts/rfdiffusion_inference.py --config-name antibody antibody.target_pdb=/opt/RFantibody/scripts/examples/example_inputs/rsv_site3.pdb antibody.framework_pdb=/opt/RFantibody/scripts/examples/example_inputs/hu-4D5-8_Fv.pdb inference.ckpt_override_path=/opt/RFantibody/weights/RFdiffusion_Ab.pt 'ppi.hotspot_res=[T305,T456]' 'antibody.design_loops=[L1:8-13,L2:7,L3:9-11,H1:7,H2:6,H3:5-13]' inference.num_designs=10 inference.output_prefix=/opt/RFantibody/scripts/examples/example_outputs/ab_desAfter the backbone design you can design sequence for the loops with ProteinMPNN. Example:
poetry run python /opt/RFantibody/scripts/proteinmpnn_interface_design.py -pdbdir /opt/RFantibody/scripts/examples/example_outputs/ -outpdbdir /opt/RFantibody/scripts/examples/example_outputs/pmpnnOther useful flags:
-seqs_per_struct 5Number of sequiences to design for an input structure-omit_AAs CRto exclude cysteine and arginine-loop_string H1,H3The list of loops which you wish to design
See all the parameters with
poetry run python /opt/RFantibody/scripts/proteinmpnn_interface_design.py -hAfter the sequence design the structures can be filtered with RF2. The scores can be found at the end of the pdb files.
poetry run python /opt/RFantibody/scripts/rf2_predict.py input.pdb_dir=/opt/RFantibody/scripts/examples/example_outputs/pmpnn output.pdb_dir=/opt/RFantibody/scripts/examples/example_outputs/rf2There are additional parameters, see it with
poetry run python /opt/RFantibody/scripts/rf2_predict.py -h| Script | Changes |
|---|---|
scripts/util/chothia2HLT.py |
Fixed CLI, added cropping, target handling |
scripts/rfdiffusion_inference.py |
Patched config paths and model loading, empty lines between the meaningful lines was removed from the output pdb |
scripts/proteinmpnn_interface_design.py |
Detection of existing output files (check.point fix), adding new arguments for name_tag and seed |
src/rfantibody/proteinmpnn/struct_manager.py |
Detection of existing output files (check.point fix) |
src/rfantibody/util/pose.py |
Fixing shifted sequence prediction windows bug for ProteinMPNN |
src/rfantibody/rf2/config/base.yaml |
changing model.model_weights to the supplied model: /opt/RFantibody/weights/RF2_ab.pt |
src/rfantibody/rf2/modules/model_runner.py |
output directory created if not exists |
setenv.sh |
Adds readable bash prompt in container |
Dockerfile |
Activates venv using ENTRYPOINT fix |
Fixed pyproject.toml |
include path fixed, biotite installation fixed |
| Component | Issue |
|---|---|
| ProteinMPNN | Cannot process Quiver input (internal StructManager bug) |
| AF3 | Seems to work better for filtering than RF2 based on [1] |
| RFantibody | The parameters of the model provided does not match the loading script, a lot of warnings are produced. T=200 is in the loaded model, but T=50 is in the config base.yaml file. No information in the paper what was the actual T used in training and what should be used at inference |
| Prompt | Appears as I have no name... inside container unless setenv.sh is sourced |
| RF2 Scores | Appear at the end of each pdb file, additional processing required |
| RF2 pBind | Not found at the end of the pdb files at allpost-processing needed from output PDB REMARKs |
- RFantibody: https://www.biorxiv.org/content/10.1101/2024.03.14.585103v1
- RFdiffusion: https://www.biorxiv.org/content/10.1101/2022.12.09.519842v1
- ProteinMPNN: https://www.science.org/doi/10.1126/science.add2187
Modifications licensed under MIT. Original code remains under RosettaCommons terms.