# cmkobel/comparem2 architecture

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

- Interactive diagram: https://gitdiagram.com/cmkobel/comparem2
- Repository: https://github.com/cmkobel/comparem2

## Overview

##### Main Components

a. Input Layer:
- Genomic assemblies (prokaryotic/bacterial/archaeal)
- Configuration files (config.yaml)

b. Core Pipeline Components:
- Workflow Manager (Snakemake)
- Batch Processing Modules:
- Quality Control
- Core/Pan Genome Analysis
- Phylogeny
- Clinical Analysis
- Advanced Annotation

c. Analysis Tools Integration Layer:
- Quality Control Tools (CheckM2)
- Annotation Tools (Prokka, AMRFinder)
- Phylogenetic Tools (GTDBtk, IQTree)
- Functional Analysis Tools (eggNOG, dbCAN)
- Comparative Analysis Tools (Panaroo, SNP-dists)

d. Report Generation System:
- R Markdown Templates
- Dynamic Report Generation
- HTML Output

##### Flow and Relationships

- Data flow from input through various analysis modules
- Dependencies between components
- Parallel execution paths
- Output generation flows

##### Detailed Elements

Specific workflow components:
- Environment management (conda/container)
- Rule execution flow
- Resource allocation
- Report template integration

##### Technical Details

- Snakemake workflow engine at the core
- Parallel execution capabilities
- Resource requirements (64GB RAM recommendation)
- Integration points with HPC systems

##### The flexibility in deployment (local/HPC)

- Different types of connections
- Component categories
- Execution flow indicators

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        GA[Genomic Assemblies]
        CF["Configuration"]:::config
    end

    subgraph "Workflow Management"
        WF["Snakemake Workflow"]:::workflow
        CF --> WF
    end

    subgraph "Batch Processing"
        QC["Quality Control"]:::batch
        CP["Core/Pan Genome"]:::batch
        PH["Phylogeny"]:::batch
        CA["Clinical Analysis"]:::batch
        AA["Advanced Annotation"]:::batch
    end

    subgraph "Analysis Tools"
        direction TB
        CM2["CheckM2"]:::tool
        PRK["Prokka"]:::tool
        AMR["AMRFinder"]:::tool
        GTDB["GTDBtk"]:::tool
        IQT["IQTree"]:::tool
        EGG["eggNOG"]:::tool
        DBC["dbCAN"]:::tool
        PAN["Panaroo"]:::tool
        SNP["SNP-dists"]:::tool
    end

    subgraph "Report Generation"
        MRT["Main Report Template"]:::report
        subgraph "Tool Reports"
            AMR_R["AMRFinder Report"]:::report
            CM2_R["CheckM2 Report"]:::report
            GTDB_R["GTDB-tk Report"]:::report
            PAN_R["Panaroo Report"]:::report
            PRK_R["Prokka Report"]:::report
        end
    end

    subgraph "HPC Integration"
        CND["Conda Profiles"]:::hpc
        CNT["Container Profiles"]:::hpc
    end

    GA --> WF
    WF --> QC & CP & PH & CA & AA

    QC --> CM2
    AA --> PRK & AMR
    PH --> GTDB & IQT
    CP --> PAN & SNP
    AA --> EGG & DBC

    CM2 --> CM2_R
    PRK --> PRK_R
    AMR --> AMR_R
    GTDB --> GTDB_R
    PAN --> PAN_R

    CM2_R & AMR_R & GTDB_R & PAN_R & PRK_R --> MRT

    classDef config fill:#AED6F1,stroke:#2E86C1
    classDef workflow fill:#A9DFBF,stroke:#27AE60
    classDef batch fill:#F9E79F,stroke:#F1C40F
    classDef tool fill:#F5B7B1,stroke:#E74C3C
    classDef report fill:#D2B4DE,stroke:#8E44AD
    classDef hpc fill:#F5CBA7,stroke:#E67E22

    click CF "https://github.com/cmkobel/comparem2/blob/master/config/config.yaml"
    click WF "https://github.com/cmkobel/comparem2/tree/master/workflow/Snakefile"
    click QC "https://github.com/cmkobel/comparem2/blob/master/workflow/rules/batch_quality_control.smk"
    click CP "https://github.com/cmkobel/comparem2/blob/master/workflow/rules/batch_core_pan.smk"
    click PH "https://github.com/cmkobel/comparem2/blob/master/workflow/rules/batch_phylogeny.smk"
    click CA "https://github.com/cmkobel/comparem2/blob/master/workflow/rules/batch_clinical.smk"
    click AA "https://github.com/cmkobel/comparem2/blob/master/workflow/rules/batch_advanced_annotation.smk"
    click CM2 "https://github.com/cmkobel/comparem2/blob/master/workflow/envs/checkm2.yaml"
    click PRK "https://github.com/cmkobel/comparem2/blob/master/workflow/envs/prokka.yaml"
    click AMR "https://github.com/cmkobel/comparem2/blob/master/workflow/envs/amrfinder.yaml"
    click GTDB "https://github.com/cmkobel/comparem2/blob/master/workflow/envs/gtdbtk.yaml"
    click IQT "https://github.com/cmkobel/comparem2/blob/master/workflow/envs/iqtree.yaml"
    click EGG "https://github.com/cmkobel/comparem2/blob/master/workflow/envs/eggnog.yaml"
    click DBC "https://github.com/cmkobel/comparem2/blob/master/workflow/envs/dbcan.yaml"
    click PAN "https://github.com/cmkobel/comparem2/blob/master/workflow/envs/panaroo.yaml"
    click SNP "https://github.com/cmkobel/comparem2/blob/master/workflow/envs/snp-dists.yaml"
    click MRT "https://github.com/cmkobel/comparem2/blob/master/dynamic_report/workflow/scripts/report_template.rmd"
    click AMR_R "https://github.com/cmkobel/comparem2/blob/master/dynamic_report/workflow/scripts/section_amrfinder.rmd"
    click CM2_R "https://github.com/cmkobel/comparem2/blob/master/dynamic_report/workflow/scripts/section_checkm2.rmd"
    click GTDB_R "https://github.com/cmkobel/comparem2/blob/master/dynamic_report/workflow/scripts/section_gtdbtk.rmd"
    click PAN_R "https://github.com/cmkobel/comparem2/blob/master/dynamic_report/workflow/scripts/section_panaroo.rmd"
    click PRK_R "https://github.com/cmkobel/comparem2/blob/master/dynamic_report/workflow/scripts/section_prokka.rmd"
    click CND "https://github.com/cmkobel/comparem2/tree/master/profile/conda"
    click CNT "https://github.com/cmkobel/comparem2/tree/master/profile/apptainer"
```
