# pmenzel/ont-assembly-snake-mit architecture

> Architecture diagram of the GitHub repository pmenzel/ont-assembly-snake-mit, 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/pmenzel/ont-assembly-snake-mit
- Repository: https://github.com/pmenzel/ont-assembly-snake-mit

## Overview

##### Main System Components

a) Input Layer:
- ONT reads directory (fastq-ont/)
- Illumina reads directory (fastq-illumina/)
- Reference genomes directory (references/)
- Reference proteins directory (references-protein/)

b) Processing Layer (organize in parallel tracks):
- Read Filtering Track (Filtlong, Rasusa)
- Assembly Track (Flye, Raven, Miniasm, Unicycler, Canu)
- Polishing Track:
- Long-read polishing (Racon, Medaka)
- Short-read polishing (Pilon, Polypolish, POLCA)
- Reference-based polishing (Homopolish, Proovframe)

c) Output Layer:
- Final assemblies directory (assemblies/)
- Intermediate results
- Symlinks to final assemblies

##### Flow and Relationships

- Blue: Input/Output operations
- Green: Assembly processes
- Orange: Polishing processes
- Purple: Reference-based operations
- Gray: Configuration and environment

##### Implementation Details

- How sample names are parsed from directory structure
- How different tool combinations are determined from folder names
- Conditional execution paths based on available input data

##### Technical Elements

Components:
- GitHub Actions workflows (.github/workflows/)
- Conda environment specifications
- Snakefile as the central workflow controller

## Diagram (Mermaid)

```mermaid
flowchart TB
    classDef input fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef process fill:#90EE90,stroke:#333,stroke-width:2px
    classDef polish fill:#FFB366,stroke:#333,stroke-width:2px
    classDef output fill:#E6E6FA,stroke:#333,stroke-width:2px
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef env fill:#FFE5CC,stroke:#333,stroke-width:2px

    subgraph Input
        ONT["ONT Reads"]:::input
        ILL["Illumina Reads"]:::input
        REF["Reference Genomes"]:::input
        PROT["Reference Proteins"]:::input
    end

    SNAKE["Snakefile"]:::config
    click SNAKE "https://github.com/pmenzel/ont-assembly-snake-MIT/tree/master/Snakefile"

    subgraph Configuration
        CICD["GitHub Actions"]:::config
        click CICD "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/.github/workflows/check-conda-envs.yml"
        CONDA["Base Environment"]:::config
        click CONDA "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-main.yaml"
    end

    subgraph "Read Filtering"
        FILT["Filtlong"]:::process
        click FILT "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-filtlong.yaml"
        RAS["Rasusa"]:::process
        click RAS "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-rasusa.yaml"
    end

    subgraph "Assembly Tools"
        FLYE["Flye"]:::process
        click FLYE "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-flye.yaml"
        RAVEN["Raven"]:::process
        click RAVEN "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-raven.yaml"
        MINI["Miniasm"]:::process
        click MINI "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-miniasm.yaml"
        UNI["Unicycler"]:::process
        click UNI "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-unicycler.yaml"
        CANU["Canu"]:::process
        click CANU "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-canu.yaml"
        MAS["MaSuRCA"]:::process
        click MAS "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-masurca.yaml"
    end

    subgraph "Long-read Polishing"
        RAC["Racon"]:::polish
        click RAC "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-racon.yaml"
        MED["Medaka"]:::polish
        click MED "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-medaka.yaml"
    end

    subgraph "Short-read Polishing"
        PIL["Pilon"]:::polish
        click PIL "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-pilon.yaml"
        POLY["Polypolish"]:::polish
        click POLY "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-polypolish.yaml"
    end

    subgraph "Reference Polishing"
        HOMO["Homopolish"]:::polish
        click HOMO "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-homopolish.yaml"
        PROOF["Proovframe"]:::polish
        click PROOF "https://github.com/pmenzel/ont-assembly-snake-MIT/blob/master/env/conda-proovframe.yaml"
    end

    subgraph Output
        FINAL["Final Assemblies"]:::output
        INTER["Intermediate Results"]:::output
        SYM["Symlinks"]:::output
    end

    ONT --> FILT & RAS
    ILL --> UNI & MAS
    FILT & RAS --> FLYE & RAVEN & MINI & CANU
    FLYE & RAVEN & MINI & CANU & UNI & MAS --> RAC
    RAC --> MED
    MED --> PIL & POLY
    PIL & POLY --> HOMO
    REF --> HOMO
    PROT --> PROOF
    HOMO & PROOF --> FINAL
    FINAL --> SYM
    
    %% Legend
    classDef legendClass fill:none,stroke:none
    subgraph Legend
        L1["Input Files"]:::input
        L2["Processing Steps"]:::process
        L3["Polishing Steps"]:::polish
        L4["Output Files"]:::output
        L5["Configuration"]:::config
    end
```
