# soedinglab/pmgen architecture

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

- Interactive diagram: https://gitdiagram.com/soedinglab/pmgen
- Repository: https://github.com/soedinglab/pmgen

## Overview

##### Project type and purpose
- PMGen is not a web app or database-backed service, but a command-line, bioinformatics workflow/pipeline.
- Purpose: orchestrate three major sub-tools—PANDORA (template generation), AlphaFold (via AFfine, structural prediction & relaxation), and ProteinMPNN (sequence design)—to model pMHC complexes, predict binding, and optionally generate novel sequences.

##### File structure
- Top-level scripts:
- run_PMGen.py (main CLI entrypoint)
- run_utils.py, run_PMGen.py launch either “modeling” (single) or “wrapper” (batch) workflows.
- user_setting.py (paths to external tools, user config).
- Major folders:
- AFFine/ — contains a fork of AlphaFold (data pipelines, models, relax modules).
- PANDORA/ — contains the PANDORA template-generation tool in PANDORA/PANDORA.
- utils/ — shared Python utilities: sequence parsing, alignment, data processing, visualization.
- data/ — input examples, HLA allele databases, test TSVs.
- Config/deployment: install.sh, environment.yml, pip_requirements.txt, dockerfile—configure Conda env and clone submodules.

##### README for additional insights
- Describes three sequential stages:
a. PANDORA templates → b. AlphaFold modeling (+relax) → c. ProteinMPNN design.
- CLI flags control which stage(s) to run, resource limits, number of sequences, and external dependencies (Modeller, netMHCpan, GPU).

##### Elements
- Blue for core modules (PANDORA, AFfine, ProteinMPNN)
- Green for orchestrator & CLI
- Orange for input/output data stores
- Rectangles for processes/modules
- Clouds for external services

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Orchestrator & Config
    subgraph "Orchestrator"
        CLI_Orch["CLI Orchestrator"]:::orchestrator
    end

    %% Input Data
    InputData["Input Data Store\n(TSV/FASTA)"]:::datastore

    %% Core Modules
    subgraph "Core Modules"
        PANDORA["PANDORA Module"]:::core
        AFFineData["AFfine Data Stage"]:::core
        AFFineModel["AFfine Model Stage"]:::core
        AFFineRelax["AFfine Relax Stage"]:::core
        ProteinMPNN["ProteinMPNN Module"]:::core
    end

    %% Utility Layer
    Utils["Utility Layer"]:::utils

    %% Output Data
    Output["Output Data Store\n(pandora/, alignment/, alphafold/, proteinmpnn/)"]:::datastore

    %% External Dependencies
    Modeller((Modeller)):::external
    NetMHC((netMHCpan/IIpan)):::external
    GPU((CUDA GPU\nJAX/TF)):::external
    Conda((Conda Env)):::external

    %% Data Flow
    CLI_Orch -->|"reads flags & settings"| InputData
    CLI_Orch -->|"invokes"| PANDORA
    PANDORA -->|"PDB templates"| AFFineData
    AFFineData -->|"alignment files"| AFFineModel
    AFFineModel -->|"predicted PDBs"| AFFineRelax
    AFFineRelax -->|"refined PDBs"| ProteinMPNN
    ProteinMPNN -->|"designed sequences"| Output

    %% Combined Output
    PANDORA -->|"templates"| Output
    AFFineData -->|"alignments"| Output
    AFFineModel -->|"models"| Output
    ProteinMPNN -->|"designs"| Output

    %% Utilities Usage
    Utils --> PANDORA
    Utils --> AFFineData
    Utils --> AFFineModel
    Utils --> AFFineRelax
    Utils --> ProteinMPNN

    %% Optional Flags
    CLI_Orch -->|"--no_alphafold skip"| AFFineData
    CLI_Orch -->|"--only_protein_mpnn"| ProteinMPNN

    %% External Invocations
    PANDORA -.->|uses| Modeller
    PANDORA -.->|uses| NetMHC
    AFFineModel -.->|requires| GPU
    CLI_Orch -.->|env setup| Conda

    %% Click Events
    click CLI_Orch "https://github.com/soedinglab/pmgen/blob/master/run_PMGen.py"
    click InputData "https://github.com/soedinglab/pmgen/tree/master/data/"
    click PANDORA "https://github.com/soedinglab/pmgen/tree/master/PANDORA/PANDORA/"
    click AFFineData "https://github.com/soedinglab/pmgen/tree/master/AFFine/alphafold/data/"
    click AFFineModel "https://github.com/soedinglab/pmgen/tree/master/AFFine/alphafold/model/"
    click AFFineRelax "https://github.com/soedinglab/pmgen/tree/master/AFFine/alphafold/relax/"
    click ProteinMPNN "https://github.com/soedinglab/pmgen/blob/master/proteinmpnn.yml"
    click Utils "https://github.com/soedinglab/pmgen/tree/master/utils/"

    %% Styles
    classDef orchestrator fill:#d5f5e3,stroke:#1e8449,color:#1e8449;
    classDef core fill:#aed6f1,stroke:#2e86c1,color:#2e86c1;
    classDef datastore fill:#fdedc1,stroke:#d68910,color:#d68910;
    classDef utils fill:#f2f3f4,stroke:#7f8c8d,color:#7f8c8d;
    classDef external stroke-dasharray:5 5,stroke:#566573,color:#566573;
```
