# vandydata/scgenepanel architecture

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

- Interactive diagram: https://gitdiagram.com/vandydata/scgenepanel
- Repository: https://github.com/vandydata/scgenepanel

## Overview

##### Main Components

a. Core Package Components:
- Data Input Handler
- Visualization Modules
- Shiny Application
- Utility Functions

b. External Dependencies:
- Seurat Integration
- SingleCellExperiment Integration

**┌─ Input Layer ─────┐    ┌─ Processing Layer ──┐    ┌─ Visualization Layer ─┐**
- Seurat Objects  │ -> │ - Data Validation   │ -> │ - UMAP Panel         │
- SingleCellExp.  │    │ - Data Transform.   │    │ - Violin Panel       │
- ┬─┘    └──────────────────┬──┘    │ - Cell Freq. Panel   │
- ┘
- ↑
- ┌─ Shiny Interface ────┐
- ┴───────>│ - Interactive UI    │
- Real-time Updates  │
- ┘

##### Component Details

a. Data Components (Rectangles, Blue):
- Input data objects
- Processed data structures

b. Processing Modules (Hexagons, Green):
- Data validation functions
- Data transformation logic

c. Visualization Components (Rounded Rectangles, Orange):
- UMAP visualization
- Violin plot generation
- Cell frequency tabulation

d. Interactive Layer (Double Rectangle, Purple):
- Shiny application interface
- User input handling
- Dynamic plot updates

##### Flow Indicators

- Data flow direction
- Component dependencies

##### Important Implementation Details to Highlight

a. File Organization:
- Relationship between R/ directory components
- Inst/shiny integration
- Test coverage flow

b. Key Functions:
- create_gene_panel()
- cellfreq_panel()
- umap_panel()
- violin_panel()

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        SO[Seurat Objects]
        SCE[SingleCellExperiment]
        ED["Example Datasets"]:::data
    end

    subgraph Processing
        DV["Data Validation"]:::validation
        DT["Data Transformation"]
        CM["Color Management"]:::color
        GP["Gene Panel Core"]:::core
    end

    subgraph Visualization
        UP["UMAP Panel"]:::umap
        VP["Violin Panel"]:::violin
        CF["Cell Frequency Panel"]:::cellfreq
    end

    subgraph Interactive
        SI["Shiny Interface"]:::shiny
        SL["Shiny Launcher"]:::launcher
        UI["User Interface"]
        RU["Real-time Updates"]
    end

    %% Data Flow
    SO --> DV
    SCE --> DV
    ED --> DV
    DV --> DT
    DT --> GP
    CM --> GP
    GP --> UP
    GP --> VP
    GP --> CF
    
    UP --> SI
    VP --> SI
    CF --> SI
    
    SI --> UI
    UI --> RU
    RU --> UP
    RU --> VP
    RU --> CF
    
    SL --> SI

    %% Styling
    classDef validation fill:#90EE90
    classDef color fill:#FFB6C1
    classDef core fill:#ADD8E6
    classDef umap fill:#FFA07A
    classDef violin fill:#FFA07A
    classDef cellfreq fill:#FFA07A
    classDef shiny fill:#DDA0DD
    classDef launcher fill:#DDA0DD
    classDef data fill:#F0E68C

    %% Click Events
    click DV "https://github.com/vandydata/scGenePanel/blob/main/R/validation.R"
    click CM "https://github.com/vandydata/scGenePanel/blob/main/R/colorpanels.R"
    click UP "https://github.com/vandydata/scGenePanel/blob/main/R/umap_panel.R"
    click VP "https://github.com/vandydata/scGenePanel/blob/main/R/violin_panel.R"
    click CF "https://github.com/vandydata/scGenePanel/blob/main/R/cellfreq_panel.R"
    click SI "https://github.com/vandydata/scGenePanel/blob/main/inst/shiny/genepanel/app.R"
    click GP "https://github.com/vandydata/scGenePanel/blob/main/R/GenePanel.R"
    click SL "https://github.com/vandydata/scGenePanel/blob/main/R/run_shiny.R"
    click ED "https://github.com/vandydata/scGenePanel/tree/main/inst/extdata"

    %% Legend
    subgraph Legend
        L1["Data Components"]:::data
        L2["Processing Components"]:::validation
        L3["Visualization Components"]:::umap
        L4["Interactive Components"]:::shiny
    end
```
