# rpetit3/sccmec architecture

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

- Interactive diagram: https://gitdiagram.com/rpetit3/sccmec
- Repository: https://github.com/rpetit3/sccmec

## Overview

##### Main Components Overview
The system should be represented with the following key components:

a) Input Processing Layer
- FASTA file input handler (compressed/uncompressed)
- Configuration parameters handler

b) Core Processing Components
- BLAST execution engine
- Target analysis module
- Region analysis module
- Results aggregator

c) Data Resources
- SCCmec targets database
- SCCmec regions database
- Reference schemas (YAML)

d) Output Generation Layer
- TSV report generators
- Results formatter

**┌─────────────────────────────────────────────────────────────┐**
- Input Layer                             │
- ┌─────────────┐    ┌─────────────┐    ┌─────────────┐     │
- FASTA Input │    │   Config    │    │  Parameter  │     │
- Handler    │    │   Parser    │    │  Validator  │     │
- ┘    └─────────────┘    └─────────────┘     │
- ┬─────────────────┬──────────────────┬───────────┘

**┌───────────▼─────────────────▼──────────────────▼───────────┐**
- Core Processing                         │
- ┌─────────────┐    ┌─────────────┐    ┌─────────────┐     │
- BLAST     │    │   Target    │    │   Region    │     │
- Engine    │◄─►│   Analysis  │◄─►│   Analysis  │     │
- ┘    └─────────────┘    └─────────────┘     │
- ┬─────────────────┬──────────────────┬───────────┘

**┌───────────▼─────────────────▼──────────────────▼───────────┐**
- Data Resources                          │
- ┌─────────────┐    ┌─────────────┐    ┌─────────────┐     │
- Targets   │    │   Regions   │    │    YAML     │     │
- Database   │    │  Database   │    │   Schemas   │     │
- ┘    └─────────────┘    └─────────────┘     │
- ┬─────────────────┬──────────────────┬───────────┘

**┌───────────▼─────────────────▼──────────────────▼───────────┐**
- Output Layer                            │
- ┌─────────────┐    ┌─────────────┐    ┌─────────────┐     │
- Results   │    │    TSV      │    │   Report    │     │
- Aggregator  │    │  Generator  │    │  Formatter  │     │
- ┘    └─────────────┘    └─────────────┘     │
- ┘

##### Additional Elements
- Parameter threshold indicators
- Supported SCCmec types list

##### Important Details
- Minimum threshold values for:
- Target percent identity (90%)
- Target coverage (80%)
- Region percent identity (85%)
- Region coverage (83%)
- File format specifications
- Supported compression types
- Output file formats and structures

##### Integration Points
- BLAST integration
- Camlhmp API usage
- Bioconda package management

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style definitions
    classDef input fill:#a8d1f0,stroke:#000
    classDef process fill:#90EE90,stroke:#000
    classDef data fill:#FFE5B4,stroke:#000
    classDef output fill:#a8d1f0,stroke:#000
    classDef config fill:#D3D3D3,stroke:#000

    %% Input Layer
    subgraph InputLayer
        FastaInput["FASTA Input Handler"]
        ConfigParser["Config Parser"]
        ParamValidator["Parameter Validator"]
    end

    %% Core Processing
    subgraph CoreProcessing
        BlastEngine["BLAST Engine"]
        TargetAnalysis["Target Analysis"]
        RegionAnalysis["Region Analysis"]
    end

    %% Data Resources
    subgraph DataResources
        TargetsDB["Targets Database"]
        RegionsDB["Regions Database"]
        YAMLSchemas["YAML Schemas"]
        RefDB["Reference Database"]
    end

    %% Output Layer
    subgraph OutputLayer
        ResultsAgg["Results Aggregator"]
        TSVGen["TSV Generator"]
        ReportFormat["Report Formatter"]
    end

    %% Connections
    FastaInput --> BlastEngine
    ConfigParser --> ParamValidator
    ParamValidator --> BlastEngine
    
    BlastEngine --> TargetAnalysis
    BlastEngine --> RegionAnalysis
    
    TargetsDB --> TargetAnalysis
    RegionsDB --> RegionAnalysis
    YAMLSchemas --> TargetAnalysis
    YAMLSchemas --> RegionAnalysis
    RefDB --> BlastEngine
    
    TargetAnalysis --> ResultsAgg
    RegionAnalysis --> ResultsAgg
    ResultsAgg --> TSVGen
    TSVGen --> ReportFormat

    %% Styling
    class FastaInput,ConfigParser,ParamValidator input
    class BlastEngine,TargetAnalysis,RegionAnalysis process
    class TargetsDB,RegionsDB,YAMLSchemas,RefDB data
    class ResultsAgg,TSVGen,ReportFormat output

    %% Click events
    click TargetAnalysis "https://github.com/rpetit3/sccmec/tree/main/bin/sccmec-targets"
    click RegionAnalysis "https://github.com/rpetit3/sccmec/tree/main/bin/sccmec-regions"
    click TargetsDB "https://github.com/rpetit3/sccmec/blob/main/data/sccmec-targets.fasta"
    click RegionsDB "https://github.com/rpetit3/sccmec/blob/main/data/sccmec-regions.fasta"
    click YAMLSchemas "https://github.com/rpetit3/sccmec/blob/main/data/sccmec-targets.yaml"
    click RefDB "https://github.com/rpetit3/sccmec/tree/main/data/genbank"
    click FastaInput "https://github.com/rpetit3/sccmec/tree/main/tests/fasta"

    %% Legend
    subgraph Legend
        L1["Input/Output"]:::input
        L2["Processing"]:::process
        L3["Data Resources"]:::data
    end
```
