# kincekara/c-bird architecture

> Architecture diagram of the GitHub repository kincekara/c-bird, 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/kincekara/c-bird
- Repository: https://github.com/kincekara/c-bird

## Overview

##### Main Components

a) Workflow Orchestration Layer:
- WDL workflow engine (Cromwell/MiniWDL) as the top-level controller
- Workflow definitions (.wdl files) from the workflows directory
- Terra.bio platform integration

b) Input Processing Layer:
- Raw data inputs (FASTQ files)
- Database inputs (Kraken2 DB, CheckM2 DB)
- Sample metadata

c) Processing Modules (Tasks):
- Tasks by function:
- Quality Control: fastp, BBTools
- Assembly: SPAdes
- Analysis:
- Taxonomy (Kraken2/Bracken, Mash)
- Quality Assessment (QUAST, CheckM2)
- Typing (MLST)
- Resistance Detection (AMRFinderPlus)
- Plasmid Analysis (PlasmidFinder)
- Reporting: cbird-util scripts

d) Output Generation:
- Report types (Basic, Extended, QC, Plain)
- Assembly results
- Analysis results

##### Specific Elements

b) Container Boundaries:
- Docker container boundaries for each tool
- Workflow engine boundary
- Platform boundary (Terra.bio)

##### Key Relationships to Highlight

- Parallel execution capabilities
- Data dependencies between tasks
- Database integration points
- Report generation flow

##### Technical Details

- Tool versions in small text
- Database version indicators
- Container references
- Resource requirements

**[Input Layer]**

**[Workflow Engine Layer]**

**[Quality Control Layer]**

**[Assembly Layer]**

**[Analysis Layer]**

**[Reporting Layer]**

**[Output Layer]**

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        direction TB
        style Legend fill:#f5f5f5,stroke:#333
        L_INPUT[Input Data]:::input
        L_WF[Workflow Component]:::workflow
        L_QC[Quality Control]:::qc
        L_ANALYSIS[Analysis Component]:::analysis
        L_REPORT[Report Component]:::report
        L_OUTPUT[Output Data]:::output
    end

    subgraph Input
        direction TB
        FASTQ[Raw FASTQ Files]:::input
        DB_KRAKEN[Kraken2 DB]:::input
        DB_CHECKM[CheckM2 DB]:::input
        METADATA[Sample Metadata]:::input
    end

    subgraph "Workflow Orchestration"
        direction TB
        CROMWELL[Cromwell/MiniWDL Engine]:::workflow
        WF_SINGLE["Single Sample Workflow"]:::workflow
        WF_MULTI["Multi Sample Workflow"]:::workflow
        click WF_SINGLE "https://github.com/Kincekara/C-BIRD/blob/main/workflows/wf_c-bird.wdl"
        click WF_MULTI "https://github.com/Kincekara/C-BIRD/blob/main/workflows/wf_multibird.wdl"
    end

    subgraph "Quality Control"
        direction TB
        FASTP[FastP Processing]:::qc
        BBTOOLS[BBTools Processing]:::qc
        QC_CHECK[QC Check]:::qc
        click FASTP "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_fastp.wdl"
        click BBTOOLS "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_bbtools.wdl"
        click QC_CHECK "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_qc_check.wdl"
    end

    subgraph Assembly
        SPADES[SPAdes Assembly]:::analysis
        click SPADES "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_spades.wdl"
    end

    subgraph Analysis
        direction TB
        TAXONOMY[Taxonomy Analysis]:::analysis
        MASH[Mash Analysis]:::analysis
        MLST[MLST Typing]:::analysis
        AMR[AMRFinderPlus]:::analysis
        PLASMID[PlasmidFinder]:::analysis
        QUAST[QUAST Assessment]:::analysis
        CHECKM2[CheckM2 Analysis]:::analysis
        click TAXONOMY "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_taxonomy.wdl"
        click MASH "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_mash.wdl"
        click MLST "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_mlst.wdl"
        click AMR "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_amrfinderplus.wdl"
        click PLASMID "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_plasmidfinder.wdl"
        click QUAST "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_quast.wdl"
        click CHECKM2 "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_checkm2.wdl"
    end

    subgraph "Report Generation"
        direction TB
        REPORT_GEN[Report Generation]:::report
        HTML_UTIL[HTML Report Utility]:::report
        PLAIN_UTIL[Plain Report Utility]:::report
        QC_UTIL[QC Report Utility]:::report
        COV_EST[Coverage Estimation]:::report
        click REPORT_GEN "https://github.com/Kincekara/C-BIRD/blob/main/tasks/task_report.wdl"
        click HTML_UTIL "https://github.com/Kincekara/C-BIRD/blob/main/cbird-util/html_report.py"
        click PLAIN_UTIL "https://github.com/Kincekara/C-BIRD/blob/main/cbird-util/plain_report.py"
        click QC_UTIL "https://github.com/Kincekara/C-BIRD/blob/main/cbird-util/qc_report.py"
        click COV_EST "https://github.com/Kincekara/C-BIRD/blob/main/cbird-util/est_coverage.py"
    end

    subgraph Outputs
        direction TB
        QC_SUMMARY[QC Summary]:::output
        BASIC_REPORT[Basic Report]:::output
        EXT_REPORT[Extended Report]:::output
        PLAIN_REPORT[Plain Report]:::output
        click QC_SUMMARY "https://github.com/Kincekara/C-BIRD/blob/main/misc/AR55_QC_summary.html"
        click BASIC_REPORT "https://github.com/Kincekara/C-BIRD/blob/main/misc/AR55_basic_report.html"
        click EXT_REPORT "https://github.com/Kincekara/C-BIRD/blob/main/misc/AR55_extended_report.html"
        click PLAIN_REPORT "https://github.com/Kincekara/C-BIRD/blob/main/misc/AR55_report.docx"
    end

    %% Connections
    FASTQ & DB_KRAKEN & DB_CHECKM & METADATA --> CROMWELL
    CROMWELL --> WF_SINGLE & WF_MULTI
    WF_SINGLE & WF_MULTI --> FASTP & BBTOOLS
    FASTP & BBTOOLS --> QC_CHECK
    QC_CHECK --> SPADES
    SPADES --> TAXONOMY & MASH & MLST & AMR & PLASMID & QUAST & CHECKM2
    TAXONOMY & MASH & MLST & AMR & PLASMID & QUAST & CHECKM2 --> REPORT_GEN
    REPORT_GEN --> HTML_UTIL & PLAIN_UTIL & QC_UTIL & COV_EST
    HTML_UTIL & PLAIN_UTIL & QC_UTIL & COV_EST --> QC_SUMMARY & BASIC_REPORT & EXT_REPORT & PLAIN_REPORT

    %% Styles
    classDef input fill:#90EE90,stroke:#333
    classDef workflow fill:#87CEEB,stroke:#333
    classDef qc fill:#FFA500,stroke:#333
    classDef analysis fill:#DDA0DD,stroke:#333
    classDef report fill:#FFB6C1,stroke:#333
    classDef output fill:#F0E68C,stroke:#333
```
