# ablab/metagt architecture

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

- Interactive diagram: https://gitdiagram.com/ablab/metagt
- Repository: https://github.com/ablab/metagt

## Overview

##### Project type and purpose
- Project Type: A bioinformatics workflow/pipeline implemented in Nextflow (DSL2).
- Purpose: “MetaGT” performs assembly and quantification of metatranscriptome data by leveraging metagenome assemblies. It orchestrates a series of analysis steps (QC, assembly, annotation, alignment, clustering, quantification) using containerized processes.

##### File structure
- Top‐level files:
- nextflow.config, main.nf, nextflow_schema.json → Nextflow pipeline entry point and configuration
- environment.yml → Conda environment spec
- bin/ → standalone Python scripts for small utility tasks (name changes, extraction, parsing)
- conf/ → pipeline configuration profiles (base, test, test_full)
- modules/ → DSL2 modules organized under “local” (custom processes) and “nf-core” (community-maintained software wrappers)
- subworkflows/ → DSL2 subworkflows for assembling genome/transcriptome
- assets/ → static templates and configs (email templates, MultiQC config)
- lib/ → Groovy support libraries (schema definitions, header injection)
- data/ → example/reference data files
- Patterns & architectural choices:
- DSL2 modularization—“modules” and “subworkflows” directories
- One container per process (Docker/Singularity managed by Nextflow)
- Profiles for different environments in conf/
- Reusable utility scripts in bin/

##### README for additional insights
- Describes pipeline steps, software dependencies (Docker, Conda, Nextflow), and how modules map to tools (FastQC, metaSPAdes/rnaSPAdes, Prokka, minimap2, TransDecoder, MMseqs2, Kallisto).
- Emphasizes reproducibility and portability via containers and Conda.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Inputs"
        D1["Genome FASTA"]:::data
        D2["Transcriptome FASTA"]:::data
    end

    subgraph "Configuration Profiles"
        CP1["base.config"]:::config
        CP2["test.config"]:::config
        CP3["test_full.config"]:::config
    end

    ENV["environment.yml"]:::env

    subgraph "Nextflow Orchestrator"
        MN["main.nf"]:::orchestrator
        CFG["nextflow.config"]:::orchestrator
        SCH["nextflow_schema.json"]:::orchestrator
    end

    subgraph "QC"
        FastQC["FastQC Module"]:::modules
    end

    subgraph "Subworkflows"
        AG["assembly_genome.nf"]:::modules
        AT["assembly_transcriptome.nf"]:::modules
    end

    subgraph "Assembly"
        SPADES["SPAdes Module"]:::modules
    end

    subgraph "Annotation"
        Prokka["Prokka Module"]:::modules
    end

    subgraph "Alignment"
        Minimap2["Minimap2 Module"]:::modules
    end

    subgraph "Extraction"
        CoveredCDS["covered_cds Module"]:::modules
        Transdecoder["TransDecoder Module"]:::modules
    end

    subgraph "Clustering"
        MMseqs["MMseqs2 Module"]:::modules
    end

    subgraph "Quantification"
        Kallisto["Kallisto Module"]:::modules
    end

    Reports["Reports (MultiQC + Email)"]:::asset

    subgraph "Utilities"
        CN["change_name.py"]:::script
        EC["extract_covered_cds.py"]:::script
        EU["extract_unaligned_transcripts.py"]:::script
        EXU["extract_unused.py"]:::script
        PY["parse_yaml.py"]:::script
    end

    subgraph "Libraries"
        Hdr["Headers.groovy"]:::lib
        Schema["NfcoreSchema.groovy"]:::lib
        Jar["nfcore_external_java_deps.jar"]:::lib
    end

    subgraph "Assets"
        ET1["email_template.html"]:::asset
        ET2["email_template.txt"]:::asset
        SMT["sendmail_template.txt"]:::asset
        MQC["multiqc_config.yaml"]:::asset
    end

    D1 --> FastQC
    D2 --> FastQC
    CP1 --> CFG
    CP2 --> CFG
    CP3 --> CFG
    CFG --> MN
    ENV --> MN
    SCH --> MN
    MN --> FastQC
    MN --> AG
    MN --> AT
    AG --> SPADES
    AT --> SPADES
    FastQC --> SPADES
    SPADES --> Prokka
    Prokka --> Minimap2
    Minimap2 --> CoveredCDS
    CoveredCDS --> Transdecoder
    Transdecoder --> MMseqs
    MMseqs --> Kallisto
    Kallisto --> Reports

    click MN "https://github.com/ablab/metagt/blob/main/main.nf"
    click CFG "https://github.com/ablab/metagt/blob/main/nextflow.config"
    click SCH "https://github.com/ablab/metagt/blob/main/nextflow_schema.json"
    click CP1 "https://github.com/ablab/metagt/blob/main/conf/base.config"
    click CP2 "https://github.com/ablab/metagt/blob/main/conf/test.config"
    click CP3 "https://github.com/ablab/metagt/blob/main/conf/test_full.config"
    click FastQC "https://github.com/ablab/metagt/blob/main/modules/nf-core/software/fastqc/main.nf"
    click SPADES "https://github.com/ablab/metagt/blob/main/modules/nf-core/software/spades/main.nf"
    click AG "https://github.com/ablab/metagt/blob/main/subworkflows/local/assembly_genome.nf"
    click AT "https://github.com/ablab/metagt/blob/main/subworkflows/local/assembly_transcriptome.nf"
    click Prokka "https://github.com/ablab/metagt/blob/main/modules/local/prokka.nf"
    click Minimap2 "https://github.com/ablab/metagt/blob/main/modules/local/minimap2.nf"
    click CoveredCDS "https://github.com/ablab/metagt/blob/main/modules/local/covered_cds.nf"
    click Transdecoder "https://github.com/ablab/metagt/blob/main/modules/local/transdecoder.nf"
    click MMseqs "https://github.com/ablab/metagt/blob/main/modules/local/mmseqs.nf"
    click Kallisto "https://github.com/ablab/metagt/blob/main/modules/local/kallisto.nf"
    click CN "https://github.com/ablab/metagt/blob/main/bin/change_name.py"
    click EC "https://github.com/ablab/metagt/blob/main/bin/extract_covered_cds.py"
    click EU "https://github.com/ablab/metagt/blob/main/bin/extract_unaligned_transcripts.py"
    click EXU "https://github.com/ablab/metagt/blob/main/bin/extract_unused.py"
    click PY "https://github.com/ablab/metagt/blob/main/bin/parse_yaml.py"
    click ET1 "https://github.com/ablab/metagt/blob/main/assets/email_template.html"
    click ET2 "https://github.com/ablab/metagt/blob/main/assets/email_template.txt"
    click SMT "https://github.com/ablab/metagt/blob/main/assets/sendmail_template.txt"
    click MQC "https://github.com/ablab/metagt/blob/main/assets/multiqc_config.yaml"
    click Hdr "https://github.com/ablab/metagt/blob/main/lib/Headers.groovy"
    click Schema "https://github.com/ablab/metagt/blob/main/lib/NfcoreSchema.groovy"
    click Jar "https://github.com/ablab/metagt/blob/main/lib/nfcore_external_java_deps.jar"
    click ENV "https://github.com/ablab/metagt/blob/main/environment.yml"

    classDef orchestrator fill:#FFD700,stroke:#333,stroke-width:1px
    classDef config fill:#FFA07A,stroke:#333,stroke-width:1px
    classDef modules fill:#8FBC8F,stroke:#333,stroke-width:1px
    classDef data fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef script fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef asset fill:#F0E68C,stroke:#333,stroke-width:1px
    classDef env fill:#E6E6FA,stroke:#333,stroke-width:1px
    classDef lib fill:#FFE4E1,stroke:#333,stroke-width:1px
```
