# nf-core/ampliseq architecture

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

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

## Overview

##### Main Components

a. Input Processing Layer:
- Raw Data Input (FASTQ files)
- Sample Sheet Processing
- Metadata Processing
- Primer Configuration

b. Quality Control Layer:
- FastQC Module
- Cutadapt Trimming Module
- MultiQC Integration

c. Core Processing Layer:
- DADA2 Processing Pipeline
- ASV Inference Engine
- VSEARCH Clustering (Optional)
- Barrnap rRNA Prediction

d. Taxonomic Classification Layer:
- Multiple Classification Options:
- DADA2 Classifier
- SINTAX Classifier
- Kraken2 Classifier
- QIIME2 Classifier

e. Analysis Layer:
- Phylogenetic Placement (EPA-NG)
- Diversity Analysis (QIIME2)
- Statistical Analysis
- Phyloseq Integration

f. Output Layer:
- Results Generation
- Report Creation
- Data Export
- Visualization Generation

**[Input Layer]**
- ↓
**[Quality Control]**
- ↓
**[Core Processing]**
- ↓
**[Classification]**
- ↓
**[Analysis]**
- ↓
**[Output]**

##### Key Relationships to Highlight

- Parallel processing capabilities where applicable
- Database connections for taxonomic classification
- Integration points between different tools
- Data flow between components

##### Technical Details

- Nextflow DSL2 workflow structure
- Container integration points
- Resource allocation points
- Data transformation steps
- Tool version compatibility

**workflows/**
- ampliseq.nf (main workflow)
- ↓
**subworkflows/**
- cutadapt_workflow
- dada2_preprocessing
- taxonomy_workflows
- qiime2_workflows

##### Infrastructure Elements

- Container runtime (Docker/Singularity)
- Resource management
- Storage requirements
- Parallel processing capabilities

##### Additional Elements

- Version information
- Database connections
- Error handling paths
- Checkpoint locations
- Resource scaling points

Remember to include the pipeline's ability to handle different input types (Illumina paired-end, single-end, PacBio, IonTorrent) and its flexibility in working with various amplicon types (16S, ITS, CO1, 18S).

This design will help users understand the pipeline's architecture while providing developers with the necessary technical details for maintenance and enhancement.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Input Processing Layer
    subgraph Input
        RawData[Raw FASTQ Data]
        SampleSheet[Sample Sheet]
        Metadata[Metadata]
        Primers[Primer Config]
        MainWorkflow["Main Workflow"]:::workflow
        ParseInput["Input Parser"]:::workflow
    end

    %% Quality Control Layer
    subgraph QC
        FastQC["FastQC"]:::module
        Cutadapt["Cutadapt"]:::module
        MultiQC["MultiQC"]:::module
        CutadaptWF["Cutadapt Workflow"]:::workflow
    end

    %% Core Processing Layer
    subgraph Core
        DADA2["DADA2 Processing"]:::module
        VSEARCH["VSEARCH Clustering"]:::module
        Barrnap["Barrnap rRNA"]:::module
        DADA2Pre["DADA2 Preprocessing"]:::workflow
    end

    %% Taxonomic Classification Layer
    subgraph Taxonomy
        DADA2Tax["DADA2 Taxonomy"]:::workflow
        SINTAX["SINTAX Classification"]:::workflow
        Kraken2["Kraken2 Classification"]:::workflow
        QIIME2Tax["QIIME2 Classification"]:::workflow
    end

    %% Analysis Layer
    subgraph Analysis
        Phyloseq["Phyloseq Integration"]:::workflow
        QIIME2Div["QIIME2 Diversity"]:::workflow
        EPANG["EPA-NG"]:::module
        QIIME2ANCOM["QIIME2 ANCOM"]:::workflow
    end

    %% Output Layer
    subgraph Output
        QIIME2Export["QIIME2 Export"]:::workflow
        ReportTemp["Report Templates"]:::asset
        MultiQCConfig["MultiQC Config"]:::asset
    end

    %% Relationships
    RawData --> MainWorkflow
    SampleSheet --> ParseInput
    Metadata --> ParseInput
    Primers --> ParseInput
    
    MainWorkflow --> FastQC
    MainWorkflow --> CutadaptWF
    CutadaptWF --> Cutadapt
    
    Cutadapt --> DADA2Pre
    DADA2Pre --> DADA2
    DADA2 --> VSEARCH
    DADA2 --> Barrnap
    
    DADA2 --> DADA2Tax
    DADA2 --> SINTAX
    DADA2 --> Kraken2
    DADA2 --> QIIME2Tax
    
    DADA2Tax --> Phyloseq
    SINTAX --> Phyloseq
    Kraken2 --> Phyloseq
    QIIME2Tax --> QIIME2Div
    
    Phyloseq --> EPANG
    QIIME2Div --> QIIME2ANCOM
    
    QIIME2ANCOM --> QIIME2Export
    FastQC --> MultiQC
    MultiQC --> ReportTemp
    MultiQC -.-> MultiQCConfig
    
    %% Click Events
    click MainWorkflow "https://github.com/nf-core/ampliseq/blob/master/workflows/ampliseq.nf"
    click ParseInput "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/parse_input.nf"
    click FastQC "https://github.com/nf-core/ampliseq/tree/master/modules/nf-core/fastqc"
    click Cutadapt "https://github.com/nf-core/ampliseq/tree/master/modules/nf-core/cutadapt"
    click MultiQC "https://github.com/nf-core/ampliseq/tree/master/modules/nf-core/multiqc"
    click CutadaptWF "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/cutadapt_workflow.nf"
    click DADA2 "https://github.com/nf-core/ampliseq/blob/master/modules/local/dada2_denoising.nf"
    click VSEARCH "https://github.com/nf-core/ampliseq/tree/master/modules/nf-core/vsearch/cluster"
    click Barrnap "https://github.com/nf-core/ampliseq/blob/master/modules/local/barrnap.nf"
    click DADA2Pre "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/dada2_preprocessing.nf"
    click DADA2Tax "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/dada2_taxonomy_wf.nf"
    click SINTAX "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/sintax_taxonomy_wf.nf"
    click Kraken2 "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/kraken2_taxonomy_wf.nf"
    click QIIME2Tax "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/qiime2_taxonomy.nf"
    click Phyloseq "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/phyloseq_workflow.nf"
    click QIIME2Div "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/qiime2_diversity.nf"
    click EPANG "https://github.com/nf-core/ampliseq/tree/master/modules/nf-core/epang"
    click QIIME2ANCOM "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/qiime2_ancom.nf"
    click QIIME2Export "https://github.com/nf-core/ampliseq/blob/master/subworkflows/local/qiime2_export.nf"
    click ReportTemp "https://github.com/nf-core/ampliseq/blob/master/assets/report_template.Rmd"
    click MultiQCConfig "https://github.com/nf-core/ampliseq/blob/master/assets/multiqc_config.yml"

    %% Styling
    classDef workflow fill:#f9f,stroke:#333,stroke-width:2px
    classDef module fill:#bbf,stroke:#333,stroke-width:2px
    classDef asset fill:#bfb,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        Workflow["Workflow"]:::workflow
        Module["Module"]:::module
        Asset["Asset"]:::asset
    end
```
