# vishnuraghuram94/agrvate architecture

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

- Interactive diagram: https://gitdiagram.com/vishnuraghuram94/agrvate
- Repository: https://github.com/vishnuraghuram94/agrvate

## Overview

##### Main Components Organization

a) Input Layer:
- Input FASTA file handler
- Database resources (agrvate_databases)
- Configuration validation

b) Processing Layer (Core Pipeline):
- Agr Group Typing Module
- Operon Extraction Module
- Frameshift Detection Module

c) Output Layer:
- Results Generation
- Error Reporting

##### Component Details and Relationships

a) Input Processing:
- FASTA file input validation
- To database resources:
- HMM profiles
- Reference sequences
- Primer databases
- Kmer databases

b) Core Pipeline (show as sequential steps):
##### Agr Typing Module
- Kmer search component
- BLAST processing
- Assignment logic

##### Operon Extraction Module (parallel paths)
- USEARCH path
- MUMmer path (alternative)
- In-silico PCR component

##### Variant Analysis
- Snippy integration
- Frameshift detection
- Reference comparison

c) Output Generation:
- Results directory creator
- Summary table generator
- Error report compiler

##### Integration Points

Integration with external tools using distinct connectors:
- NCBI BLAST+
- USEARCH/MUMmer
- Snippy
- HMMER
- SeqKit

##### Notes

Annotations for:
- Version compatibility
- Operating system requirements
- Memory/CPU requirements
- Database dependencies

- The linear workflow nature of the tool
- The modular design allowing for alternative tools
- The comprehensive error checking at each step
- The multiple output formats and their relationships

Keep the abstraction level focused on the major components while showing the critical path of data flow through the system. This will help other developers understand both the high-level architecture and the specific implementation details necessary for maintenance and extension of the tool.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        L1[Core Component]:::core
        L2[Input/Output]:::io
        L3[External Tool]:::external
        L4[Error Handler]:::error
        L5[Database]:::database
    end

    subgraph "Input Layer"
        Input[FASTA Input]:::io
        Config[Configuration Validation]:::core
        
        subgraph "Database Resources"
            direction TB
            DB_Main["Database Resources"]:::database
            HMM["HMM Profiles"]:::database
            Primers["Primer Database"]:::database
            Kmers["Motif Database"]:::database
            
            subgraph "Reference Sequences"
                direction TB
                Ref1["Group 1 Reference"]:::database
                Ref2["Group 2 Reference"]:::database
                Ref3["Group 3 Reference"]:::database
                Ref4["Group 4 Reference"]:::database
                MumRef["MUMmer Reference"]:::database
            end
        end
    end

    subgraph "Processing Layer"
        direction TB
        AgrType["Agr Group Typing Module"]:::core
        OpEx["Operon Extraction Module"]:::core
        Frame["Frameshift Detection"]:::core

        subgraph "External Tools"
            BLAST["NCBI BLAST+"]:::external
            USEARCH["USEARCH"]:::external
            MUMmer["MUMmer"]:::external
            Snippy["Snippy"]:::external
            HMMER["HMMER"]:::external
            SeqKit["SeqKit"]:::external
        end
    end

    subgraph "Output Layer"
        Results["Results Generator"]:::io
        ErrorReport["Error Reporter"]:::error
        Summary["Summary Tables"]:::io
    end

    %% Relationships
    Input --> Config
    Config --> AgrType
    DB_Main --> AgrType
    AgrType --> OpEx
    OpEx --> Frame
    Frame --> Results
    Frame --> ErrorReport
    Results --> Summary

    %% External Tool Connections
    AgrType --> BLAST
    OpEx --> USEARCH
    OpEx --> MUMmer
    Frame --> Snippy
    AgrType --> HMMER
    Input --> SeqKit

    %% Database Connections
    DB_Main --> HMM
    DB_Main --> Primers
    DB_Main --> Kmers
    DB_Main --> Ref1
    DB_Main --> Ref2
    DB_Main --> Ref3
    DB_Main --> Ref4
    DB_Main --> MumRef

    %% Styling
    classDef core fill:#a2d2ff
    classDef io fill:#90be6d
    classDef external fill:#f9c74f
    classDef error fill:#f94144
    classDef database fill:#577590

    %% Click Events
    click DB_Main "https://github.com/VishnuRaghuram94/AgrVATE/tree/main/agrvate_databases/"
    click HMM "https://github.com/VishnuRaghuram94/AgrVATE/blob/main/agrvate_databases/agrD_hmm.hmm"
    click Primers "https://github.com/VishnuRaghuram94/AgrVATE/blob/main/agrvate_databases/agr_operon_primers.fa"
    click Kmers "https://github.com/VishnuRaghuram94/AgrVATE/blob/main/agrvate_databases/gp1234_all_motifs.fna"
    click Ref1 "https://github.com/VishnuRaghuram94/AgrVATE/blob/main/agrvate_databases/references/gp1-operon_ref.gbk"
    click Ref2 "https://github.com/VishnuRaghuram94/AgrVATE/blob/main/agrvate_databases/references/gp2-operon_ref.gbk"
    click Ref3 "https://github.com/VishnuRaghuram94/AgrVATE/blob/main/agrvate_databases/references/gp3-operon_ref.gbk"
    click Ref4 "https://github.com/VishnuRaghuram94/AgrVATE/blob/main/agrvate_databases/references/gp4-operon_ref.gbk"
    click MumRef "https://github.com/VishnuRaghuram94/AgrVATE/blob/main/agrvate_databases/references/mummer_ref_operon.fna"
    click AgrType "https://github.com/VishnuRaghuram94/AgrVATE/tree/main/agrvate/"
```
