# listerlab/home architecture

> Architecture diagram of the GitHub repository listerlab/home, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/listerlab/home
- Repository: https://github.com/listerlab/home

## Overview

##### Main Components

a) Input Processing Layer:
- File Input Handlers (supporting both custom format and BSSeeker2 CGmap files)
- Sample Configuration Parser
- Data Validation Components

b) Core Processing Components:
- Histogram Feature Generator
- SVM Classifier Module
- DMR Detection Engine (split into two main paths):
- Pairwise DMR Detection
- Time Series DMR Detection

c) Data Storage:
- Model Storage (saved_model directory)
- Training Data Repository
- Temporary Processing Storage

##### Component Relationships

**[Input Files] → [Input Processing Layer]**
- ↓
**[Training Data] → [Feature Generation] → [SVM Classification]**
- ↓
- [DMR Detection Engine]
- /                    \
- [Pairwise Mode]                  [Time Series Mode]
- ↓                                ↓
- [DMR Output]                      [DMR Output]

##### Important Details

a) Processing Parameters:
- Configuration options for both modes
- Parameters (scorecutoff, pruncutoff, etc.)

b) Parallel Processing:
- Multi-core processing capability
- Chromosome-level parallelization option

##### Technical Specifications

A technical stack sidebar showing:
- Python 2.7
- Key Dependencies:
- numpy
- pandas
- scipy
- scikit-learn
- statsmodels

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        IF[/"Input Files"\]:::io
        SC[/"Sample Configuration"\]:::io
    end

    subgraph "Input Processing"
        FIH["File Input Handlers"]:::process
        SCP["Sample Config Parser"]:::process
        DV["Data Validation"]:::process
    end

    subgraph "Core Processing"
        HFG["Histogram Feature Generator"]:::process
        click HFG "https://github.com/ListerLab/HOME/blob/master/HOME/HOME_functions.py"
        
        subgraph "SVM Classification"
            SVMC["SVM Classifier"]:::process
            MS[(Model Storage)]:::storage
            click MS "https://github.com/ListerLab/HOME/tree/master/saved_model"
        end
        
        subgraph "Training Data"
            TD_CG[("CG Training Data")]:::storage
            click TD_CG "https://github.com/ListerLab/HOME/blob/master/training_data/training_data_CG.txt"
            TD_NCG[("Non-CG Training Data")]:::storage
            click TD_NCG "https://github.com/ListerLab/HOME/blob/master/training_data/training_data_nonCG.txt"
            HF_CG[("CG Histogram Features")]:::storage
            click HF_CG "https://github.com/ListerLab/HOME/blob/master/training_data/hist_data_CG.npy"
            HF_NCG[("Non-CG Histogram Features")]:::storage
            click HF_NCG "https://github.com/ListerLab/HOME/blob/master/training_data/hist_data_nonCG.npy"
        end
    end

    subgraph "DMR Detection Engine"
        direction TB
        subgraph "Pairwise Mode"
            PWD["Pairwise Detection"]:::process
            click PWD "https://github.com/ListerLab/HOME/tree/master/scripts/HOME-pairwise"
            PWR["R Processing"]:::process
            click PWR "https://github.com/ListerLab/HOME/blob/master/scripts/HOME_R.R"
        end
        
        subgraph "Time Series Mode"
            TSD["Time Series Detection"]:::process
            click TSD "https://github.com/ListerLab/HOME/tree/master/scripts/HOME-timeseries"
            TSR["R Processing"]:::process
            click TSR "https://github.com/ListerLab/HOME/tree/master/scripts/HOME_R_time"
        end
    end

    subgraph "Model Components"
        CG_W[("CG Weights")]:::storage
        click CG_W "https://github.com/ListerLab/HOME/blob/master/saved_model/CG/W.npy"
        CG_B[("CG Bias")]:::storage
        click CG_B "https://github.com/ListerLab/HOME/blob/master/saved_model/CG/b.npy"
        NCG_W[("Non-CG Weights")]:::storage
        click NCG_W "https://github.com/ListerLab/HOME/blob/master/saved_model/nonCG/W.npy"
        NCG_B[("Non-CG Bias")]:::storage
        click NCG_B "https://github.com/ListerLab/HOME/blob/master/saved_model/nonCG/b.npy"
    end

    subgraph Output
        DMR_OUT[/"DMR Results"\]:::io
    end

    %% Connections
    IF --> FIH
    SC --> SCP
    FIH --> DV
    SCP --> DV
    DV --> HFG
    HFG --> SVMC
    TD_CG --> SVMC
    TD_NCG --> SVMC
    MS --> SVMC
    SVMC --> PWD
    SVMC --> TSD
    PWD --> PWR
    TSD --> TSR
    PWR --> DMR_OUT
    TSR --> DMR_OUT
    CG_W --> SVMC
    CG_B --> SVMC
    NCG_W --> SVMC
    NCG_B --> SVMC

    %% Styles
    classDef process fill:#90EE90,stroke:#333,stroke-width:2px
    classDef storage fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef io fill:#87CEEB,stroke:#333,stroke-width:2px
    
    %% Legend
    subgraph Legend
        L1[Process]:::process
        L2[(Storage)]:::storage
        L3[/Input/Output\]:::io
    end
```
