# ablab/isoquant architecture

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

## Overview

##### Main Components

a) Input Processing Layer:
- Multiple input sources (FASTQ/FASTA files, BAM files)
- Reference genome (mandatory)
- Optional gene annotation (GFF/GTF)
- Read grouping information

b) Core Processing Pipeline:
- Read Mapping Component (using minimap2)
- Alignment Processing
- Transcript Model Construction
- Isoform Assignment
- Quantification Engine

c) Output Generation Layer:
- Transcript models
- Gene/isoform quantification
- Expression tables
- Statistics and logs

##### Component Relationships

**[Input Layer]**
- ↓
**[Preprocessing]**
- ↓
**[Core Processing]**
- ↓
**[Output Layer]**

##### Specific Implementation Details

a) Input Processing (Blue Components):
- Parallel input paths for FASTQ/FASTA and BAM files
- Reference data input (genome, annotation)
- To the read mapper component

b) Core Processing (Green Components):
- Alignment_processor module
- Gene_model and isoform_assignment modules
- Multimap_resolver component
- Long_read_counter module

c) Analysis Modules (Yellow Components):
- Exon_corrector and illumina_exon_corrector
- Polya_finder and verification
- Graph_based_model_construction

d) Output Generation (Purple Components):
- Transcript_printer module
- Statistics generation
- Visualization components

##### Technical Details

- Python 3.8 requirement
- External dependencies (gffutils, pysam, pybedtools)
- File format handling capabilities
- Database interaction points

##### Component Grouping

Related components using containers:
- Input Processing Container
- Alignment Processing Container
- Model Construction Container
- Quantification Container
- Output Generation Container

##### Additional Elements

- Version information (3.6)
- Supported data types (PacBio CCS, ONT dRNA/cDNA)
- Configuration points
- Error handling paths

Remember to highlight the modular nature of the system, showing how components like the exon corrector can be optionally included in the pipeline.

This design should reflect IsoQuant's primary purpose of analyzing long RNA reads and producing accurate transcript models and quantification results.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Define styles
    classDef input fill:#a8d1f0,stroke:#000
    classDef core fill:#90EE90,stroke:#000
    classDef analysis fill:#FFE5B4,stroke:#000
    classDef output fill:#DDA0DD,stroke:#000
    classDef support fill:#E6E6FA,stroke:#000

    %% Input Layer
    subgraph InputLayer
        FastqFasta["FASTQ/FASTA Files"]:::input
        BamFiles["BAM Files"]:::input
        RefGenome["Reference Genome"]:::input
        GeneAnnot["Gene Annotation\n(GFF/GTF)"]:::input
        ReadGroups["Read Grouping Info"]:::input
        InputHandler["Input Handler"]:::input
        FileUtils["File Utilities"]:::input
        ReadGroupProc["Read Group Processing"]:::input
    end

    %% Core Processing Layer
    subgraph CoreProcessing
        ReadMapper["Read Mapper"]:::core
        AlignProc["Alignment Processor"]:::core
        GeneModel["Gene Model Handler"]:::core
        IsoAssign["Isoform Assignment"]:::core
        TransModel["Transcript Model\nConstruction"]:::core
        QuantEngine["Quantification Engine"]:::core
    end

    %% Analysis Modules
    subgraph Analysis
        ExonCorr["Exon Corrector"]:::analysis
        IllumExonCorr["Illumina Exon\nCorrector"]:::analysis
        PolyA["PolyA Finder"]:::analysis
        PolyAVerif["PolyA Verification"]:::analysis
        MultimapRes["Multimap Resolver"]:::analysis
    end

    %% Output Layer
    subgraph OutputLayer
        TransOut["Transcript Output"]:::output
        StatsGen["Statistics Generation"]:::output
        Viz["Visualization"]:::output
    end

    %% Supporting Components
    subgraph Support
        GeneInfo["Gene Information"]:::support
        AlignInfo["Alignment Information"]:::support
        CommonUtils["Common Utilities"]:::support
        ProfileHandler["Profile Handler"]:::support
    end

    %% Connections
    FastqFasta & BamFiles --> InputHandler
    RefGenome & GeneAnnot --> InputHandler
    ReadGroups --> ReadGroupProc
    InputHandler --> ReadMapper
    FileUtils --> InputHandler
    ReadMapper --> AlignProc
    AlignProc --> GeneModel
    GeneModel --> IsoAssign
    IsoAssign --> TransModel
    TransModel --> QuantEngine
    QuantEngine --> TransOut
    ExonCorr --> TransModel
    IllumExonCorr --> TransModel
    PolyA --> PolyAVerif
    PolyAVerif --> TransModel
    MultimapRes --> QuantEngine
    TransOut --> StatsGen
    StatsGen --> Viz
    GeneInfo --> GeneModel
    AlignInfo --> AlignProc
    CommonUtils --> CoreProcessing
    ProfileHandler --> QuantEngine

    %% Click events for component mapping
    click InputHandler "https://github.com/ablab/IsoQuant/blob/master/src/input_data_storage.py"
    click FileUtils "https://github.com/ablab/IsoQuant/blob/master/src/file_utils.py"
    click ReadGroupProc "https://github.com/ablab/IsoQuant/blob/master/src/read_groups.py"
    click ReadMapper "https://github.com/ablab/IsoQuant/blob/master/src/read_mapper.py"
    click AlignProc "https://github.com/ablab/IsoQuant/blob/master/src/alignment_processor.py"
    click GeneModel "https://github.com/ablab/IsoQuant/blob/master/src/gene_model.py"
    click IsoAssign "https://github.com/ablab/IsoQuant/blob/master/src/isoform_assignment.py"
    click TransModel "https://github.com/ablab/IsoQuant/blob/master/src/graph_based_model_construction.py"
    click QuantEngine "https://github.com/ablab/IsoQuant/blob/master/src/long_read_counter.py"
    click ExonCorr "https://github.com/ablab/IsoQuant/blob/master/src/exon_corrector.py"
    click IllumExonCorr "https://github.com/ablab/IsoQuant/blob/master/src/illumina_exon_corrector.py"
    click PolyA "https://github.com/ablab/IsoQuant/blob/master/src/polya_finder.py"
    click PolyAVerif "https://github.com/ablab/IsoQuant/blob/master/src/polya_verification.py"
    click MultimapRes "https://github.com/ablab/IsoQuant/blob/master/src/multimap_resolver.py"
    click TransOut "https://github.com/ablab/IsoQuant/blob/master/src/transcript_printer.py"
    click StatsGen "https://github.com/ablab/IsoQuant/blob/master/src/stats.py"
    click Viz "https://github.com/ablab/IsoQuant/blob/master/src/plot_output.py"
    click GeneInfo "https://github.com/ablab/IsoQuant/blob/master/src/gene_info.py"
    click AlignInfo "https://github.com/ablab/IsoQuant/blob/master/src/alignment_info.py"
    click CommonUtils "https://github.com/ablab/IsoQuant/blob/master/src/common.py"
    click ProfileHandler "https://github.com/ablab/IsoQuant/blob/master/src/long_read_profiles.py"
```
