# lucylgao/clusterpval-experiments architecture

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

- Interactive diagram: https://gitdiagram.com/lucylgao/clusterpval-experiments
- Repository: https://github.com/lucylgao/clusterpval-experiments

## Overview

- Simulation Code: Represented by the directory “simulation-code”, this component contains various R scripts (e.g., naive_type1.R, our_type1.R, cond_power.R, etc.) that run simulation experiments.
- Simulation Results: Represented by “simulation-results”, these Rdata files are generated by running the scripts in simulation-code.
- Figures Generation: Two parts here:
- “figures-code” includes the R scripts that actually call the code to produce the final figures.
- “figures” holds the output PDFs that are used in the paper.
- Real Data Analysis: Represented by “real-data-code”, where scripts such as penguins.R and zheng.R perform analyses on real external datasets (with external data downloaded from provided links).

##### Data and Workflow Relationships
- Simulation Workflow:
- The simulation scripts in “simulation-code” run to produce simulation data outputs.
- These outputs are stored as “simulation-results” which are then consumed by either the figures-code or directly referenced when producing figures.
- Figures Generation Workflow:
- The “figures-code” uses the simulation results (and in some cases additional processing) to produce publication-grade figures that are stored in the “figures” directory.
- Real Data Analysis Workflow:
- The “real-data-code” scripts import external datasets, process them, and generate respective analysis results and potentially figures (although the final figures for the paper seem to be separated).

##### Architectural Patterns & Design Principles
- Pipeline-driven Execution: The project is organized as a sequence of processing steps – simulation generation, results storage, and figures production – similar to a scientific data pipeline.
- Modularity: Each directory (simulation, real-data, figures) clearly represents a separate concern. The simulation-code and real-data-code are self-contained and independent yet feed into a central figure generation process.
- Reproducibility: The design emphasizes a reproducible workflow, where outputs (results and figures) are directly traceable back to the source R scripts.

##### Relevant Technologies
- R Language: All components are realized through R scripts and R-specific data files (.Rdata, .Rhistory) which hint at statistical computing frameworks.
- External Data Sources: In real-data-code, external links for datasets (penguins, T-cell, B-cell, monocyte data) are critical dependencies.
- File-based Workflow: The use of distinct directories for code, results, and figures naturally lends itself to a file-based data pipeline architecture.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Simulation Pipeline"
        simCode["Simulation Code"]:::code
        simResults(("Simulation Results")):::database
        figCode["Figures Code"]:::code
        figures["Figures"]:::document
        simCode -->|"produces"| simResults
        simResults -->|"feeds"| figCode
        figCode -->|"generates"| figures
    end

    subgraph "Real Data Analysis"
        extData["External Datasets"]:::external
        realData["Real Data Code"]:::code
        analysis["Analysis Results"]:::document
        extData -->|"download"| realData
        realData -->|"generates"| analysis
        analysis -->|"contributes"| figures
    end

    click simCode "https://github.com/lucylgao/clusterpval-experiments/tree/master/simulation-code"
    click simResults "https://github.com/lucylgao/clusterpval-experiments/tree/master/simulation-results"
    click figCode "https://github.com/lucylgao/clusterpval-experiments/tree/master/figures-code"
    click figures "https://github.com/lucylgao/clusterpval-experiments/tree/master/figures"
    click realData "https://github.com/lucylgao/clusterpval-experiments/tree/master/real-data-code"

    classDef code fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef database fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef document fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
