# rosettacommons/rfantibody architecture

> Architecture diagram of the GitHub repository rosettacommons/rfantibody, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rosettacommons/rfantibody
- Repository: https://github.com/rosettacommons/rfantibody

## Overview

##### Project Type and Purpose
- RFantibody is a full-stack, multi-step computational pipeline for structure-based de novo antibody (and nanobody) design.
- It integrates three main methods – structure design using RFdiffusion (with antibody‐fine tuning), sequence design via ProteinMPNN, and in silico filtering/validation using an antibody-adapted version of RoseTTAFold2 (RF2).
- Additionally, it includes utility modules for handling Quiver files (a custom archive format for many designs) and support libraries (e.g., SE3Transformer and USalign).

##### Main Components
- User/host environment: Represents the end-user’s workstation or cloud compute environment equipped with Docker and an NVIDIA GPU.
- Docker Environment:
- Docker container (built via the provided Dockerfile) where the pipeline is executed.
- Input Preparation:
- HLT file preparation module (runs scripts like chothia_to_HLT.py) that formats PDB files into HLT files.
- RFdiffusion Module:
- Responsible for antibody-target docking using a fine-tuned version of RFdiffusion.
- Accepts target PDB and framework/HLT PDB as inputs.
- Outputs designed backbone structures (potentially written as either PDB or Quiver files).
- ProteinMPNN Module:
- A separate component that takes the backbone designs from RFdiffusion (or from the Quiver file) and assigns sequences to the designed CDR loops.
- RF2 Module:
- Acts as a structure predictor and confidence estimator to evaluate the designed antibodies by re-predicting their structure.
- Quiver Utilities:
- Includes command-line tools (e.g., qvfrompdbs, qvls, qvextractspecific, qvrename, qvscorefile, qvsplit) used to bundle, list, modify, and extract designs.
- External Dependencies:
- External libraries like SE3Transformer and USalign which are available in the “include” directory.
- Also mention that the project uses Python (with Poetry for environment management) and third-party libraries such as Deep Graph Library (DGL).

##### Representing Interactions and Data Flows
- From the “User/Host” to “Docker Environment”: indicating that Docker is required and that the entire pipeline is started from the host.
- From the “Input Preparation” module to the “RFdiffusion Module”: showing the conversion of input PDB files (with Chothia annotations) into HLT-formatted files.
- From RFdiffusion to ProteinMPNN: the backbone designs (either as individual PDBs or packaged in a Quiver file) are passed as input for sequence design.
- From ProteinMPNN to RF2 Module: the generated designs with sequences are then evaluated by RF2.
- Also, include side paths that utilize the “Quiver Utilities”, which can act both as input and output handlers between steps.

##### Architectural Patterns and Design Principles
- The separation of concerns is prominent: each step (RFdiffusion, ProteinMPNN, RF2) works independently and communicates via well-defined file formats (HLT files and Quiver files).
- Modularity: each module can be developed and updated separately.
- Containerization: Since the entire pipeline is encapsulated within a Docker container, show a boundary labeled “Docker Container” that encloses most of the execution modules.
- GPU Acceleration: Explicitly represent a “GPU” symbol connected to the modules that require heavy computation (RFdiffusion and RF2).

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["User/Host System (Docker & GPU required)"]:::user

    subgraph "Docker Container"
        DOCK["Docker Environment"]:::docker
        IP["Input Preparation (HLT conversion)"]:::prep
        RD["RFdiffusion Module (Antibody Docking)"]:::compute
        PM["ProteinMPNN Module (Sequence Design)"]:::compute
        RF2["RF2 Module (Structure Prediction & Evaluation)"]:::compute
        QU["Quiver Utilities (File Management)"]:::utility
        DOCK -->|"PrepareInputs"| IP
        IP -->|"HLTFile"| RD
        RD -->|"BackboneDesigns"| PM
        PM -->|"DesignedSequences"| RF2
        RD ---|"QuiverFile"| QU
        PM ---|"QuiverFile"| QU
        RF2 ---|"PredictedStructures&Scores"| QU
    end

    GPU["GPU Acceleration"]:::gpu
    A -->|"StartsPipeline"| DOCK
    GPU -->|"accelerates"| RD
    GPU -->|"accelerates"| RF2

    ST["SE3Transformer Library"]:::external
    US["USalign Library"]:::external
    DOCK ---|"includes"| ST
    DOCK ---|"includes"| US

    click IP "https://github.com/rosettacommons/rfantibody/blob/main/scripts/util/chothia2HLT.py"
    click RD "https://github.com/rosettacommons/rfantibody/tree/main/src/rfantibody/rfdiffusion"
    click PM "https://github.com/rosettacommons/rfantibody/tree/main/src/rfantibody/proteinmpnn"
    click RF2 "https://github.com/rosettacommons/rfantibody/tree/main/src/rfantibody/rf2"
    click QU "https://github.com/rosettacommons/rfantibody/tree/main/bin"
    click QU "https://github.com/rosettacommons/rfantibody/blob/main/src/rfantibody/util/quiver.py"
    click ST "https://github.com/rosettacommons/rfantibody/tree/main/include/SE3Transformer"
    click US "https://github.com/rosettacommons/rfantibody/tree/main/include/USalign"
    click DOCK "https://github.com/rosettacommons/rfantibody/tree/main/Dockerfile"

    classDef user fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef docker fill:#D5F5E3,stroke:#1E8449,stroke-width:2px;
    classDef prep fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef compute fill:#FAD7A0,stroke:#CA6F1E,stroke-width:2px;
    classDef utility fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef gpu fill:#F5CBA7,stroke:#AF601A,stroke-width:2px;
```
