# ammaraziz/wfi architecture

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

## Overview

##### Main Components

a) Input Layer:
- Raw FASTQ files directory
- Configuration components (config.yaml)
- Reference data (adapters, profiles, and reference sequences)

b) Processing Layer:
- Trimming Module (with two options: BBDuk or Cutadapt)
- IRMA Processing Pipeline
- Custom Processing Modules (RSV and FLU-avian-pgm)

c) Output Layer:
- Assemblies directory structure
- Analysis results (figures and tables)
- Quality control reports

##### Key Relationships to Highlight

a) Data Flow:
- Raw FASTQ → Trimming → IRMA Processing → Assembly Output
- Configuration → Pipeline Control → Module Selection
- Reference Data → Processing Modules

b) Tool Integration:
- Snakemake workflow management
- R scripts for analysis and visualization
- Python scripts for subtyping

##### Specific Design Elements

- Rectangles: Processing modules
- Diamonds: Decision points
- Rounded rectangles: External tools/dependencies

- Blue: Input components
- Green: Processing modules
- Yellow: Configuration elements
- Orange: Output components
- Purple: External dependencies

##### Configuration Layer
- config.yaml
- Adapter files
- Reference sequences

##### Pipeline Control Layer
- Snakemake workflow
- Module selection logic

##### Processing Layer
- Trimming modules
- IRMA processing
- Custom modules (RSV/FLU)

##### Analysis Layer
- R scripts
- Python subtyper
- Quality control

##### Output Layer
- Organized assembly results
- Figures and tables
- Summary reports

##### Important Details

- Version compatibility notes
- Technology options (Illumina/ONT/PGM)
- Organism-specific workflows (FLU/RSV)
- Data validation checkpoints
- Error handling paths

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        config["Configuration (config.yaml)"]:::config
        adapters["Adapter Files"]:::input
        ref["Reference Sequences"]:::input
        raw["Raw FASTQ Files"]:::input
    end

    subgraph Pipeline_Control
        snake["Snakemake Workflow"]:::control
        deps["Dependencies"]:::control
    end

    subgraph Processing
        direction TB
        trim{"Trimming Module"}:::process
        trim -->|BBDuk| proc
        trim -->|Cutadapt| proc
        
        subgraph proc["Processing Modules"]
            direction TB
            rsv["RSV Module"]:::process
            flu["FLU Module"]:::process
            irma["IRMA Core"]:::process
        end
    end

    subgraph Analysis
        direction TB
        depth["Depth Analysis"]:::analysis
        qc["QC Analysis"]:::analysis
        summary["Summary Generation"]:::analysis
        subtype["Sequence Subtyping"]:::analysis
    end

    subgraph External_Dependencies
        blat["BLAT"]:::external
        sam["SAM Tools"]:::external
        shogun["Shogun Toolbox"]:::external
        ssw["SSW"]:::external
    end

    subgraph Output
        assembly["Assemblies"]:::output
        figures["Figures"]:::output
        reports["QC Reports"]:::output
    end

    %% Relationships
    config --> snake
    adapters --> trim
    ref --> proc
    raw --> trim
    
    snake --> trim
    snake --> proc
    deps --> proc
    
    proc --> depth
    proc --> qc
    proc --> summary
    proc --> subtype
    
    depth --> figures
    qc --> reports
    summary --> reports
    subtype --> reports

    %% External Dependencies
    blat --> proc
    sam --> proc
    shogun --> proc
    ssw --> proc

    %% Click Events
    click config "https://github.com/ammaraziz/wfi/blob/master/config/config.yaml"
    click adapters "https://github.com/ammaraziz/wfi/tree/master/bin/adapters/"
    click ref "https://github.com/ammaraziz/wfi/tree/master/bin/custom_modules/RSV/reference/"
    click rsv "https://github.com/ammaraziz/wfi/tree/master/bin/custom_modules/RSV/"
    click flu "https://github.com/ammaraziz/wfi/blob/master/bin/custom_modules/FLU-avian-pgm.sh"
    click depth "https://github.com/ammaraziz/wfi/blob/master/tools/depthPlots.R"
    click qc "https://github.com/ammaraziz/wfi/blob/master/tools/qcTable.R"
    click summary "https://github.com/ammaraziz/wfi/blob/master/tools/summaryReport.R"
    click subtype "https://github.com/ammaraziz/wfi/blob/master/tools/subtyper.py"
    click snake "https://github.com/ammaraziz/wfi/tree/master/snakefile"
    click deps "https://github.com/ammaraziz/wfi/blob/master/conda.yaml"

    %% Styles
    classDef config fill:#FFE873
    classDef input fill:#AEC6CF
    classDef control fill:#77DD77
    classDef process fill:#98FB98
    classDef analysis fill:#DDA0DD
    classDef external fill:#B19CD9
    classDef output fill:#FFB347

    %% Legend
    subgraph Legend
        direction TB
        l1["Configuration"]:::config
        l2["Input Data"]:::input
        l3["Pipeline Control"]:::control
        l4["Processing"]:::process
        l5["Analysis"]:::analysis
        l6["External Tools"]:::external
        l7["Output"]:::output
    end
```
