# marionilab/emptydrops2017 architecture

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

- Interactive diagram: https://gitdiagram.com/marionilab/emptydrops2017
- Repository: https://github.com/marionilab/emptydrops2017

## Overview

##### Main Components
- Data Downloading and Preparation: Represented by the "data" folder, which contains shell scripts (download_10x.sh, download_placenta.sh) for acquiring raw datasets from external sources.
- Analysis Pipelines: Encapsulated in the "analysis" directory. Each subfolder (neurons_900, pbmc4k, placenta) contains its own self-contained analysis (analysis.Rmd) and plotting module (plot_maker.R). Treat these as separate processing units that take raw datasets and generate results.
- Simulation Framework: Located in the "simulations" directory with scripts (simrun.R, plotsim.R, functions.R) that simulate data scenarios to test cell detection methods.
- Real Data Analysis: Found in the "real" directory with R scripts (realrun.R, negcheck.R) that tackle the analysis of actual datasets and validate the statistical properties (like p-value distributions).
- Manuscript Compilation: The "manuscript" directory includes LaTeX files, a Makefile for compiling the document, and supporting files (bibliography, class files, figures). This component assembles figures and tables generated by the analysis into a final paper.

##### Relationships and Interactions
- Data flows from the Data Downloading scripts to the Analysis and Real Data Analysis pipelines. Both analysis streams consume external datasets.
- The Simulation component stands relatively parallel to the main analysis, providing an independent validation of cell detection methods.

##### Architectural Patterns and Technologies
- Pipeline/Workflow organization: Each major task (data acquisition, simulation, analysis, manuscript generation) is neatly separated, making it a modular structure.
- Scripting Nodes: Most of the functionality is driven by R and R Markdown (for reproducible analysis and plot generation), along with shell scripts for data download and a Makefile for LaTeX compilation.
- Emphasis on Reproducibility: The separation of concerns (individual directories per dataset and analysis type) emphasizes modular and reproducible research practices.

- Three blocks under “Analysis” (one for each data set: neurons_900, pbmc4k, placenta) showing the paired scripts for analysis and plotting.
- A “Real Data Analysis” block that shows scripts performing the application of cell detection methods.
- A “Simulations” block that captures simulation code and plotting for evaluating methods.
- Finally, all outputs converge into a “Manuscript Generation” block, highlighting the integration of results (figures, tables) into the final paper.
- Annotations that describe the directional flows and dependencies between these components.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Data Acquisition Subgraph
    subgraph "Data Acquisition"
        D1("download_10x.sh"):::shell
        D2("download_placenta.sh"):::shell
    end

    %% Analysis Pipelines Subgraph
    subgraph "Analysis Pipelines"
        subgraph "neurons_900"
            A_N_R("analysis.Rmd"):::rmd
            A_N_P("plot_maker.R"):::rscript
        end
        subgraph "pbmc4k"
            A_P_R("analysis.Rmd"):::rmd
            A_P_P("plot_maker.R"):::rscript
        end
        subgraph "placenta"
            A_Pla_R("analysis.Rmd"):::rmd
            A_Pla_P("plot_maker.R"):::rscript
        end
    end

    %% Simulations Subgraph
    subgraph "Simulations"
        S1("simrun.R"):::rscript
        S2("plotsim.R"):::rscript
        S3("functions.R"):::rscript
    end

    %% Real Data Analysis Subgraph
    subgraph "Real Data Analysis"
        R1("realrun.R"):::rscript
        R2("negcheck.R"):::rscript
    end

    %% Manuscript Compilation Subgraph
    subgraph "Manuscript Compilation"
        M1("Makefile"):::make
        M2("debrief.tex"):::latex
        M3("additional.tex"):::latex
        M4("comments.Rmd"):::rmd
        M5("Supporting Files"):::latex
    end

    %% Data Flow from Data Acquisition to Analysis Pipelines and Real Data Analysis
    D1 --- A_N_R
    D1 --- A_P_R
    D1 --- A_Pla_R
    D1 --- R1
    D2 --- A_N_R
    D2 --- A_P_R
    D2 --- A_Pla_R
    D2 --- R1

    %% Flow within Simulations
    S1 --> S2
    S3 --> S2

    %% Flow within Real Data Analysis
    R1 --> R2

    %% Output flows from Analysis Pipelines to Manuscript Compilation
    A_N_P --> M5
    A_P_P --> M5
    A_Pla_P --> M5

    %% Output flows from Simulations and Real Data Analysis to Manuscript Compilation
    S2 --> M5
    R2 --> M5

    %% Style Definitions
    classDef shell fill:#f4a261,stroke:#264653,stroke-width:2px,color:#ffffff;
    classDef rmd fill:#2a9d8f,stroke:#264653,stroke-width:2px,color:#ffffff;
    classDef rscript fill:#e76f51,stroke:#264653,stroke-width:2px,color:#ffffff;
    classDef make fill:#e9c46a,stroke:#264653,stroke-width:2px,color:#ffffff;
    classDef latex fill:#457b9d,stroke:#1d3557,stroke-width:2px,color:#ffffff;

    %% Click Events
    click D1 "https://github.com/marionilab/emptydrops2017/blob/master/data/download_10x.sh"
    click D2 "https://github.com/marionilab/emptydrops2017/blob/master/data/download_placenta.sh"
    click A_N_R "https://github.com/marionilab/emptydrops2017/blob/master/analysis/neurons_900/analysis.Rmd"
    click A_N_P "https://github.com/marionilab/emptydrops2017/blob/master/analysis/neurons_900/plot_maker.R"
    click A_P_R "https://github.com/marionilab/emptydrops2017/blob/master/analysis/pbmc4k/analysis.Rmd"
    click A_P_P "https://github.com/marionilab/emptydrops2017/blob/master/analysis/pbmc4k/plot_maker.R"
    click A_Pla_R "https://github.com/marionilab/emptydrops2017/blob/master/analysis/placenta/analysis.Rmd"
    click A_Pla_P "https://github.com/marionilab/emptydrops2017/blob/master/analysis/placenta/plot_maker.R"
    click S1 "https://github.com/marionilab/emptydrops2017/blob/master/simulations/simrun.R"
    click S2 "https://github.com/marionilab/emptydrops2017/blob/master/simulations/plotsim.R"
    click S3 "https://github.com/marionilab/emptydrops2017/blob/master/simulations/functions.R"
    click R1 "https://github.com/marionilab/emptydrops2017/blob/master/real/realrun.R"
    click R2 "https://github.com/marionilab/emptydrops2017/blob/master/real/negcheck.R"
    click M1 "https://github.com/marionilab/emptydrops2017/tree/master/manuscript/Makefile"
    click M2 "https://github.com/marionilab/emptydrops2017/blob/master/manuscript/debrief.tex"
    click M3 "https://github.com/marionilab/emptydrops2017/blob/master/manuscript/additional.tex"
    click M4 "https://github.com/marionilab/emptydrops2017/blob/master/manuscript/comments.Rmd"
    click M5 "https://github.com/marionilab/emptydrops2017/tree/master/manuscript/pics/"
```
