# nf-core/proteinfold architecture

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

- Interactive diagram: https://gitdiagram.com/nf-core/proteinfold
- Repository: https://github.com/nf-core/proteinfold

## Overview

##### Main Components Identification

The system should be divided into these major components:
- Input Processing Layer
- Workflow Selection Layer
- Database Management Layer
- Prediction Engines Layer
- Output Processing Layer

##### Component Relationships

- Input/Output processes (blue)
- Core prediction engines (green)
- Database operations (yellow)
- Utility processes (gray)

##### Specific Implementation Details

AlphaFold2:
- Standard mode: Single process flow
- Split mode: Separate MSA and prediction processes

ColabFold:
- Webserver mode: API interaction flow
- Local mode: Local search flow

ESMFold:
- Monomer/multimer prediction flow

##### Technical Stack Representation

Technology badges for:
- Nextflow runtime
- Container technologies (Docker/Singularity)
- GPU support
- Database systems

##### Infrastructure Components

Integration with:
- AWS cloud infrastructure
- Local compute resources
- Container orchestration
- Storage systems

##### Pipeline-Specific Elements

Highlight:
- Parallel execution paths
- Resource allocation points
- Checkpoint/resume capabilities
- Error handling and recovery

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef input fill:#a8d1f0,stroke:#333
    classDef workflow fill:#90ee90,stroke:#333
    classDef database fill:#ffeb99,stroke:#333
    classDef prediction fill:#98fb98,stroke:#333
    classDef output fill:#b19cd9,stroke:#333
    classDef container fill:#d3d3d3,stroke:#333

    %% Input Processing Layer
    subgraph InputLayer
        Input["Sample Sheet Input"]:::input
        Config["Configuration Validator"]:::input
        Resources["Resource Manager"]:::input
    end
    click Input "https://github.com/nf-core/proteinfold/blob/master/assets/samplesheet.csv"
    click Config "https://github.com/nf-core/proteinfold/blob/master/assets/schema_input.json"
    click Resources "https://github.com/nf-core/proteinfold/blob/master/conf/base.config"

    %% Workflow Selection Layer
    subgraph WorkflowLayer
        AF2["AlphaFold2 Workflow"]:::workflow
        CF["ColabFold Workflow"]:::workflow
        ESM["ESMFold Workflow"]:::workflow
    end
    click AF2 "https://github.com/nf-core/proteinfold/blob/master/workflows/alphafold2.nf"
    click CF "https://github.com/nf-core/proteinfold/blob/master/workflows/colabfold.nf"
    click ESM "https://github.com/nf-core/proteinfold/blob/master/workflows/esmfold.nf"

    %% Database Management Layer
    subgraph DBLayer
        AF2DB["AlphaFold2 DB"]:::database
        CFDB["ColabFold DB"]:::database
        ESMDB["ESMFold DB"]:::database
        DBConfig["Database Config"]:::database
    end
    click AF2DB "https://github.com/nf-core/proteinfold/blob/master/subworkflows/local/prepare_alphafold2_dbs.nf"
    click CFDB "https://github.com/nf-core/proteinfold/blob/master/subworkflows/local/prepare_colabfold_dbs.nf"
    click ESMDB "https://github.com/nf-core/proteinfold/blob/master/subworkflows/local/prepare_esmfold_dbs.nf"
    click DBConfig "https://github.com/nf-core/proteinfold/blob/master/conf/dbs.config"

    %% Prediction Engines Layer
    subgraph PredictionLayer
        AF2Engine["AlphaFold2 Engine"]:::prediction
        AF2MSA["AF2 MSA"]:::prediction
        AF2Pred["AF2 Prediction"]:::prediction
        CFEngine["ColabFold Engine"]:::prediction
        ESMEngine["ESMFold Engine"]:::prediction
    end
    click AF2Engine "https://github.com/nf-core/proteinfold/blob/master/modules/local/run_alphafold2.nf"
    click AF2MSA "https://github.com/nf-core/proteinfold/blob/master/modules/local/run_alphafold2_msa.nf"
    click AF2Pred "https://github.com/nf-core/proteinfold/blob/master/modules/local/run_alphafold2_pred.nf"
    click CFEngine "https://github.com/nf-core/proteinfold/blob/master/modules/local/colabfold_batch.nf"
    click ESMEngine "https://github.com/nf-core/proteinfold/blob/master/modules/local/run_esmfold.nf"

    %% Output Processing Layer
    subgraph OutputLayer
        MultiQC["MultiQC Report"]:::output
        Results["Results Aggregator"]:::output
        QC["Quality Checks"]:::output
    end
    click MultiQC "https://github.com/nf-core/proteinfold/blob/master/modules/nf-core/multiqc/main.nf"
    click Results "https://github.com/nf-core/proteinfold/blob/master/docs/output.md"
    click QC "https://github.com/nf-core/proteinfold/blob/master/assets/multiqc_config.yml"

    %% Container Infrastructure
    subgraph Containers
        AF2Container["AF2 Container"]:::container
        CFContainer["CF Container"]:::container
        ESMContainer["ESM Container"]:::container
    end
    click AF2Container "https://github.com/nf-core/proteinfold/tree/master/dockerfiles/Dockerfile_nfcore-proteinfold_alphafold2_standard"
    click CFContainer "https://github.com/nf-core/proteinfold/tree/master/dockerfiles/Dockerfile_nfcore-proteinfold_colabfold"
    click ESMContainer "https://github.com/nf-core/proteinfold/tree/master/dockerfiles/Dockerfile_nfcore-proteinfold_esmfold"

    %% Connections
    Input --> Config
    Config --> Resources
    Resources --> WorkflowLayer

    AF2 --> AF2DB
    CF --> CFDB
    ESM --> ESMDB
    DBConfig --> AF2DB
    DBConfig --> CFDB
    DBConfig --> ESMDB

    AF2DB --> AF2Engine
    AF2Engine --> AF2MSA
    AF2MSA --> AF2Pred
    CFDB --> CFEngine
    ESMDB --> ESMEngine

    AF2Pred --> Results
    CFEngine --> Results
    ESMEngine --> Results
    Results --> MultiQC
    Results --> QC

    AF2Engine -.-> AF2Container
    CFEngine -.-> CFContainer
    ESMEngine -.-> ESMContainer

    %% Legend
    subgraph Legend
        L1["Input Process"]:::input
        L2["Workflow"]:::workflow
        L3["Database"]:::database
        L4["Prediction"]:::prediction
        L5["Output"]:::output
        L6["Container"]:::container
    end
```
