# j-andrews7/strprofiler architecture

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

## Overview

##### Main Components

a) Core Components:
- STR Profile Processing Engine (strprofiler.py)
- Command Line Interface (cli.py)
- CLASTR Integration Module (clastr.py)
- Utility Functions (utils.py)
- Shiny Web Application (shiny_app/)

b) External Services:
- CLASTR REST API
- Cellosaurus Database

##### Component Relationships and Data Flow

Top Layer (User Interfaces):
- CLI Interface
- Shiny Web Application

Middle Layer (Processing):
- STR Profile Processing Engine
- Calculation Functions
- CLASTR API Integration

Bottom Layer (Data):
- File Input/Output
- External Database Connections

##### Specific Implementation Details

**[User Layer]**

- CLI Interface |     | Shiny Web App    |

- ↓                     ↓
**[Processing Layer]**

- STR Profile Processing Engine    |

- Profile Matcher| | Score Calculator| |

- ↓                     ↓
**[Integration Layer]**

- CLASTR API     |     | Database Handler |
- Integration    |     |                  |

- ↓                     ↓
**[External Services]**

- CLASTR REST API|     | Local/Custom     |
- (Cellosaurus)  |     | STR Database     |

##### Important Flows to Highlight

a) CLI Flow:
Input Files → CLI → Profile Processing → Results Output

b) Web App Flow:
User Input → Shiny App → Calculation Functions → CLASTR API → Results Display

c) Database Operations:
Custom Database → Database Handler → Profile Processing → Score Calculation

##### Key Features to Emphasize

- Multiple Input Format Support (wide/long format)
- Scoring Algorithms (Tanabe, Masters)
- Sample Mixing Detection
- Database Comparison Capabilities
- CLASTR API Integration

##### Technical Details

- Python Package Structure
- File Format Support (CSV, XLSX, TSV)
- API Integration Points
- Configuration Options

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef integration fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef database fill:#34495e,stroke:#2c3e50,color:white

    %% User Layer
    subgraph User_Layer
        CLI["Command Line Interface"]:::ui
        ShinyApp["Shiny Web Application"]:::ui
    end

    %% Processing Layer
    subgraph Processing_Layer
        STREngine["STR Profile Processing Engine"]:::core
        CalcFunc["Calculation Functions"]:::core
        Utils["Utility Functions"]:::core
        
        subgraph Testing_Framework
            ProfileTests["Profile Matcher Tests"]:::core
            DBTests["Database Handler Tests"]:::core
            MixingTests["Sample Mixing Detection Tests"]:::core
            IngressTests["Data Ingress Tests"]:::core
            CLASTRTests["CLASTR Integration Tests"]:::core
        end
    end

    %% Integration Layer
    subgraph Integration_Layer
        CLASTR["CLASTR Integration Module"]:::integration
        CLASTRApi["CLASTR API Integration"]:::integration
        DBHandler["Database Handler"]:::integration
    end

    %% Data Layer
    subgraph Data_Layer
        MainDB["Main Database"]:::database
        SampleDB["Sample Database"]:::database
        CLASTRExternal["CLASTR REST API"]:::external
        Cellosaurus["Cellosaurus Database"]:::external
    end

    %% Relationships
    CLI --> STREngine
    ShinyApp --> CalcFunc
    CalcFunc --> STREngine
    STREngine --> Utils
    STREngine --> CLASTR
    CLASTR --> CLASTRExternal
    CLASTRExternal --> Cellosaurus
    STREngine --> DBHandler
    DBHandler --> MainDB
    DBHandler --> SampleDB
    ShinyApp --> CLASTRApi
    CLASTRApi --> CLASTRExternal

    %% Click Events
    click CLI "https://github.com/j-andrews7/strprofiler/blob/main/strprofiler/cli.py"
    click ShinyApp "https://github.com/j-andrews7/strprofiler/blob/main/strprofiler/shiny_app/shiny_app.py"
    click STREngine "https://github.com/j-andrews7/strprofiler/blob/main/strprofiler/strprofiler.py"
    click CalcFunc "https://github.com/j-andrews7/strprofiler/blob/main/strprofiler/shiny_app/calc_functions.py"
    click Utils "https://github.com/j-andrews7/strprofiler/blob/main/strprofiler/utils.py"
    click CLASTR "https://github.com/j-andrews7/strprofiler/blob/main/strprofiler/clastr.py"
    click CLASTRApi "https://github.com/j-andrews7/strprofiler/blob/main/strprofiler/shiny_app/clastr_api.py"
    click MainDB "https://github.com/j-andrews7/strprofiler/blob/main/strprofiler/shiny_app/www/main_database.csv"
    click SampleDB "https://github.com/j-andrews7/strprofiler/blob/main/strprofiler/shiny_app/www/Example_Custom_Database.csv"
    click ProfileTests "https://github.com/j-andrews7/strprofiler/blob/main/tests/unit/test_scoring.py"
    click DBTests "https://github.com/j-andrews7/strprofiler/blob/main/tests/unit/test_database.py"
    click MixingTests "https://github.com/j-andrews7/strprofiler/blob/main/tests/unit/test_mixing.py"
    click IngressTests "https://github.com/j-andrews7/strprofiler/blob/main/tests/unit/test_ingress.py"
    click CLASTRTests "https://github.com/j-andrews7/strprofiler/blob/main/tests/unit/test_clastr.py"

    %% Legend
    subgraph Legend
        UI["User Interface"]:::ui
        Core["Core Components"]:::core
        Int["Integration Components"]:::integration
        Ext["External Services"]:::external
        DB["Databases"]:::database
    end
```
