# sokrypton/colabdesign architecture

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

- Interactive diagram: https://gitdiagram.com/sokrypton/colabdesign
- Repository: https://github.com/sokrypton/colabdesign

## Overview

##### Main Components
- User Interface/Entry Point: Google Colab notebooks and associated interfaces (e.g., the numerous Jupyter notebooks in “af”, “colabdesign”, “mpnn”, etc.) that enable end-users to interact with the design methods.
- Protein Design Modules:
- AfDesign: For structure-guided design using AlphaFold.
- TrDesign: For design using TrRosetta.
- RfDesign: (Work-In-Progress) for structure design using RoseTTAFold.
- ProteinMPNN: For sequence design.
- ESM_MSA and SEQ components: For sequence modeling and multiple sequence alignment (MSA) based designs.
- Shared / Common Utilities: The “colabdesign/shared” directory and helper modules that provide shared functions (e.g., input preprocessing, utilities for protein representations, and argument parsing).
- Backend Computational Models:
- Under “colabdesign/af/alphafold” you have the complete set of routines for deep learning-based structure prediction.
- Similarly, “colabdesign/mpnn”, “colabdesign/esm_msa”, and “colabdesign/tr” each have their own model code, data preparation scripts, and weight files.
- External Dependencies: Configuration files (e.g., setup.py, MANIFEST.in), and integration points for CI/CD (in the .github/workflows directory).

##### Relationships and Interactions
- The notebooks in the “af”, “tr”, “mpnn”, etc. directories serve as user-accessible interfaces that pass inputs (sequences or structural data) to the respective computational models.
- Each design module wraps its computational model (e.g., AlphaFold in AfDesign) with pre- and post-processing utilities available in “colabdesign/shared” (and similar shared directories).
- The “colabdesign/” main package, which includes submodules (af, esm_msa, mpnn, rf, seq, tr), acts as the container that integrates various models and utilities.
- Data flow should be represented from the user-interface (Colab notebooks or scripts) to the module’s core computational engine, the shared pre-processing and post-processing layers, and finally to the output (designed protein sequence or structure).

##### Recognize Important Architectural Patterns and Design Principles
- Modularity: The repository is organized into multiple, mostly independent modules (af, tr, mpnn, etc.) each of which focuses on a specific design paradigm.
- Reusability: Shared utilities are centrally maintained (e.g., under “colabdesign/shared”) to avoid redundancy.
- Layered Design: The system separates user interaction (Colab notebooks), business logic (model-specific design modules), and lower-level utilities/data handling (shared libraries and preprocessing scripts).

##### Relevant Technologies, Frameworks, and Libraries
- Python is the primary programming language with deep-learning frameworks embedded in the modules (e.g., TensorFlow in the AlphaFold “tf” module, as well as possible PyTorch usage in MP Design modules).
- Jupyter notebooks are used extensively for prototyping and demonstrating workflows.
- GitHub Actions (see .github/workflows) indicates automated testing and possibly build/publish steps.
- Pretrained model weights (e.g., under mpnn/weights) signal that the modules depend on external model data.

##### Elements
- UI Components (perhaps rounded rectangles)
- Core Computational Modules (solid rectangles)
- External resources like pre-trained weight files and workflows

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        UI["User Interface (Colab Notebooks)"]:::ui
        UIaf["af Notebooks"]:::ui
        UItr["tr Notebooks"]:::ui
        UImpnn["mpnn Notebooks"]:::ui
        UIesm["esm_msa Notebooks"]:::ui
        UIrf["rf Notebooks"]:::ui
    end
    UI --> UIaf
    UI --> UItr
    UI --> UImpnn
    UI --> UIesm
    UI --> UIrf

    %% Shared Utilities Layer
    subgraph "Shared Utilities Layer"
        Shared["Shared Utilities"]:::shared
    end

    UIaf --> Shared
    UItr --> Shared
    UImpnn --> Shared
    UIesm --> Shared
    UIrf --> Shared

    %% Protein Design Modules
    subgraph "Protein Design Modules"
        %% AfDesign Module (AlphaFold-based)
        subgraph "AfDesign Module (AlphaFold)"
            AfCore["Core Implementation"]:::module
            subgraph "Scripts & Utilities"
                AfDesignPy["design.py"]:::module
                AfInputs["inputs.py"]:::module
                AfLoss["loss.py"]:::module
                AfModel["model.py"]:::module
                AfPrep["prep.py"]:::module
                AfUtils["utils.py"]:::module
            end
            AfContrib["Contrib Functions"]:::module
        end

        %% TrDesign Module (TrRosetta-based)
        TrModule["TrDesign Module (TrRosetta)"]:::module

        %% RfDesign Module (RoseTTAFold - Work-In-Progress)
        RfModule["RfDesign Module (RoseTTAFold)"]:::module

        %% ProteinMPNN Module (Sequence Design)
        subgraph "ProteinMPNN Module (Sequence Design)"
            MPNNCore["Core Implementation"]:::module
            MPNNLegacy["Legacy/Examples"]:::module
            MPNNWeights["Weights"]:::module
            MPNNWeightsSol["Weights Soluble"]:::module
        end

        %% ESM_MSA Module (MSA-based design)
        ESMModule["ESM_MSA Module"]:::module

        %% SEQ Module (Sequence Modeling)
        SeqModule["SEQ Module"]:::module
    end

    %% Connections from Shared Utilities Layer to Modules
    Shared --> AfCore
    Shared --> TrModule
    Shared --> RfModule
    Shared --> MPNNCore
    Shared --> ESMModule
    Shared --> SeqModule

    %% Connections within AfDesign Module
    AfCore --> AfDesignPy
    AfCore --> AfInputs
    AfCore --> AfLoss
    AfCore --> AfModel
    AfCore --> AfPrep
    AfCore --> AfUtils
    AfCore --> AfContrib

    %% Connections within ProteinMPNN Module
    MPNNCore --> MPNNLegacy
    MPNNCore --> MPNNWeights
    MPNNCore --> MPNNWeightsSol

    %% Output Layer
    subgraph "Output Layer"
        Output["Designed Protein Structures/Sequences"]:::output
    end

    AfContrib --> Output
    TrModule --> Output
    RfModule --> Output
    AfUtils --> Output
    AfModel --> Output
    MPNNLegacy --> Output
    MPNNWeights --> Output
    MPNNWeightsSol --> Output
    ESMModule --> Output
    SeqModule --> Output

    %% External Dependencies / CI & Configuration
    subgraph "External Dependencies"
        CI["CI/CD Pipeline (.github/workflows)"]:::external
        Setup["Setup & Packaging (setup.py, MANIFEST.in)"]:::external
        Readme["Project Info (README.md)"]:::external
    end

    CI --> Shared
    Setup --> Shared
    Readme --> Shared

    %% Click Events for User Interface
    click UIaf "https://github.com/sokrypton/colabdesign/blob/main/af/design.ipynb"
    click UItr "https://github.com/sokrypton/colabdesign/blob/main/tr/design.ipynb"
    click UImpnn "https://github.com/sokrypton/colabdesign/tree/main/mpnn/examples"
    click UIesm "https://github.com/sokrypton/colabdesign/blob/main/esm_msa/example.ipynb"
    click UIrf "https://github.com/sokrypton/colabdesign/tree/main/rf/examples"

    %% Click Events for Shared Utilities
    click Shared "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/shared"

    %% Click Events for AfDesign Module
    click AfCore "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/af/alphafold"
    click AfDesignPy "https://github.com/sokrypton/colabdesign/blob/main/colabdesign/af/design.py"
    click AfInputs "https://github.com/sokrypton/colabdesign/blob/main/colabdesign/af/inputs.py"
    click AfLoss "https://github.com/sokrypton/colabdesign/blob/main/colabdesign/af/loss.py"
    click AfModel "https://github.com/sokrypton/colabdesign/blob/main/colabdesign/af/model.py"
    click AfPrep "https://github.com/sokrypton/colabdesign/blob/main/colabdesign/af/prep.py"
    click AfUtils "https://github.com/sokrypton/colabdesign/blob/main/colabdesign/af/utils.py"
    click AfContrib "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/af/contrib"

    %% Click Events for TrDesign Module
    click TrModule "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/tr"

    %% Click Events for RfDesign Module
    click RfModule "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/rf"

    %% Click Events for ProteinMPNN Module
    click MPNNCore "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/mpnn"
    click MPNNLegacy "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/mpnn/legacy"
    click MPNNWeights "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/mpnn/weights"
    click MPNNWeightsSol "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/mpnn/weights_soluble"

    %% Click Events for ESM_MSA & SEQ Modules
    click ESMModule "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/esm_msa"
    click SeqModule "https://github.com/sokrypton/colabdesign/tree/main/colabdesign/seq"

    %% Click Events for External Dependencies
    click CI "https://github.com/sokrypton/colabdesign/tree/main/.github/workflows"
    click Setup "https://github.com/sokrypton/colabdesign/blob/main/setup.py"
    click Readme "https://github.com/sokrypton/colabdesign/blob/main/README.md"

    %% Styles
    classDef ui fill:#FFEEAD,stroke:#333,stroke-width:2px;
    classDef shared fill:#C6E2FF,stroke:#333,stroke-width:2px;
    classDef module fill:#C2EABD,stroke:#333,stroke-width:2px;
    classDef output fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef external fill:#FFDAB9,stroke:#333,stroke-width:2px;
```
