# tiger-ai-lab/disprotedit architecture

> Architecture diagram of the GitHub repository tiger-ai-lab/disprotedit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tiger-ai-lab/disprotedit
- Repository: https://github.com/tiger-ai-lab/disprotedit

## Overview

##### Project type and purpose
- DisProtEdit is a machine-learning framework (“protein editing framework”) with:
– A data pipeline ingesting and preprocessing the SwissProtDis dataset
– A dual-channel training pipeline (structural vs. functional representations)
– An editing/inference component that applies learned latent edits via text prompts
– Supporting artifacts: benchmarks, website, CI

##### (minimal) file structure
- .github/workflows/static.yml → Continuous-integration (static checks, linting)
- README.md, LICENSE → Documentation / licensing
- (Absence of src/ suggests code is in a different branch or hidden; infer standard ML project layout)

##### Extract architecture insights from README
- Core modules: dataset creation (SwissProtDis), alignment & regularization losses (MMD), disentangled latent encoder, text-based editing API
- Outputs: trained model checkpoints, editing benchmarks
- External touchpoints: arXiv, project website, future Hugging Face dataset

##### Main components
A. Data Layer
– SwissProtDis Dataset (raw protein sequences + GPT-4o-generated text descriptions)
– Data Preprocessing (tokenization, text-sequence alignment)
B. Training Pipeline
– Dual-Channel Encoder (Structural-Channel, Functional-Channel)
– Loss Modules (Alignment Loss, Uniformity Loss, Angular MMD Loss)
C. Model Artifacts
– Disentangled Latent Representations
– Checkpoints & Serialized Models
D. Editing / Inference Service
– Text-Prompt Interface (CLI or REST API)
– Sequence Editor (applies edits in latent space → generates new protein sequences)
E. Evaluation & Benchmarking
– Editing Benchmark Module (under construction)
– Metrics Dashboard
F. External Integrations
– Website (Docs + Demo)
– arXiv / Publication Link
– (Future) Hugging Face Dataset Hosting
G. CI/CD
– GitHub Actions (static analysis via .github/workflows/static.yml)

##### Relationships & Data Flow
- Within Training Pipeline: connect Encoder sub-modules to Loss Modules → Model Artifacts
- Artifacts feed both the Inference Service and the Evaluation Module
- Inference Service ↔ User / API Clients
- CI/CD monitors code changes → triggers linting/tests → deploys website & docs

##### Architectural patterns & principles
- Modular pipeline: clear separation of data ingestion, model training, inference, evaluation
- Dual-channel supervision: two parallel encoder streams with shared latent space
- Plug-and-play losses: each MMD/loss module “plugs in” via dependency injection
- Service-oriented: inference exposed as a standalone service (CLI/REST)

- Data layer: Python, BioPython (presumed), GPT-4o for text decomposition
- Training: PyTorch or JAX (inferred), CUDA/GPU acceleration
- API: FastAPI/Flask (if REST), Python CLI
- CI/CD: GitHub Actions (static analysis, future testing)
- Hosting: GitHub Pages (website), Hugging Face (dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Layer
    subgraph "Data Layer"
        direction TB
        SwissProt["SwissProtDis Dataset"]:::data
        Preprocess["Data Preprocessing"]:::compute
    end

    %% Training Pipeline
    subgraph "Training Pipeline"
        direction TB
        subgraph "Dual-Channel Encoder"
            direction TB
            StructChan["Structural-Channel Encoder"]:::compute
            FuncChan["Functional-Channel Encoder"]:::compute
        end
        subgraph "Loss Modules"
            direction TB
            AlignLoss["Alignment Loss"]:::compute
            Uniformity["Uniformity Loss"]:::compute
            MMDLoss["Angular MMD Loss"]:::compute
        end
    end

    %% Model Artifacts
    subgraph "Model Artifacts"
        direction TB
        Latent["Disentangled Latent Representations"]:::compute
        Checkpoints["Checkpoints & Serialized Models"]:::data
    end

    %% Inference Service
    subgraph "Editing / Inference Service"
        direction TB
        API["Text-Prompt Interface (CLI/REST API)"]:::service
        Editor["Sequence Editor"]:::service
    end

    %% Evaluation & Benchmarking
    subgraph "Evaluation & Benchmarking"
        direction TB
        Benchmark["Editing Benchmark Module"]:::compute
        Dashboard["Metrics Dashboard"]:::service
    end

    %% External Integrations
    subgraph "External Integrations"
        direction TB
        Website["Project Website (Docs + Demo)"]:::external
        Arxiv["Publication (arXiv)"]:::external
        HF["Hugging Face Dataset (Future)"]:::external
    end

    %% CI/CD
    subgraph "Infrastructure & CI/CD"
        direction TB
        CICD["CI/CD (GitHub Actions Static Analysis)"]:::infra
        Docs["Documentation & Project Overview"]:::infra
        License["Licensing Information"]:::infra
    end

    %% Connections
    SwissProt -->|ingests| Preprocess
    Preprocess -->|feeds| StructChan
    Preprocess -->|feeds| FuncChan
    StructChan -->|supervises| AlignLoss
    FuncChan -->|supervises| AlignLoss
    StructChan -->|supervises| Uniformity
    FuncChan -->|supervises| Uniformity
    StructChan -->|supervises| MMDLoss
    FuncChan -->|supervises| MMDLoss
    AlignLoss --> Latent
    Uniformity --> Latent
    MMDLoss --> Latent
    Latent --> Checkpoints
    Checkpoints --> API
    Checkpoints --> Editor
    Latent --> Benchmark
    Benchmark --> Dashboard
    API -->|serves| User["User / API Clients"]:::external
    Editor -->|generates| User
    CICD -->|monitors| Docs
    CICD -->|monitors| License
    CICD -->|triggers| Website
    Website -->|hosts| Docs

    %% Click Events
    click CICD "https://github.com/tiger-ai-lab/disprotedit/blob/main/.github/workflows/static.yml"
    click Docs "https://github.com/tiger-ai-lab/disprotedit/blob/main/README.md"
    click License "https://github.com/tiger-ai-lab/disprotedit/tree/main/LICENSE"

    %% Styles
    classDef data fill:#CCE5FF,stroke:#3399FF,color:#000
    classDef compute fill:#DFF2BF,stroke:#4F8A10,color:#000
    classDef service fill:#FFD2D2,stroke:#D8000C,color:#000
    classDef infra fill:#EEEEEE,stroke:#888888,color:#000
    classDef external fill:#F3E2A9,stroke:#B48A14,color:#000endmodule
```
