# thelovelab/deseq2 architecture

> Architecture diagram of the GitHub repository thelovelab/deseq2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thelovelab/deseq2
- Repository: https://github.com/thelovelab/deseq2
- Video tour (about a minute): https://gitdiagram.com/thelovelab/deseq2/video

## Overview

DESeq2 is an R package for differential analysis of count data, principally RNA-seq. Users provide counts and sample metadata, construct a DESeqDataSet, run the DESeq analysis workflow, and inspect statistical results and visualizations. The workflow includes normalization, dispersion estimation, and negative-binomial GLM fitting; Wald and likelihood-ratio tests produce results that can be further processed with fold-change shrinkage. The package also supports variance-stabilizing and regularized-log transformations. The README is empty and source excerpts are limited, so links for documented but unsampled capabilities are kept at the module level.

Main entry points: [`R/core.R`](https://github.com/thelovelab/deseq2/blob/devel/R/core.R) (DESeq Workflow), [`R/AllClasses.R`](https://github.com/thelovelab/deseq2/blob/devel/R/AllClasses.R) (DESeqDataSet), [`R/results.R`](https://github.com/thelovelab/deseq2/blob/devel/R/results.R) (Result Extraction), [`R/plots.R`](https://github.com/thelovelab/deseq2/blob/devel/R/plots.R) (Plots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data and Workflow"]
  node_dataset["DESeqDataSet<br/>[AllClasses.R]"]
  node_workflow["DESeq Workflow<br/>[core.R]"]
end

subgraph group_model["Model Fitting"]
  node_normalization["Size Factors<br/>[core.R]"]
  node_dispersion["Dispersion Estimation<br/>[core.R]"]
  node_glm["Negative Binomial GLMs<br/>[fitNbinomGLMs.R]"]
  node_cpp["Numerical Fitting<br/>[DESeq2.cpp]"]
end

subgraph group_inference["Inference"]
  node_wald["Wald Test<br/>[core.R]"]
  node_lrt["Likelihood Ratio Test<br/>[core.R]"]
  node_results["Result Extraction<br/>[results.R]"]
  node_shrink["Fold Change Shrinkage<br/>[lfcShrink.R]"]
end

subgraph group_explore["Transform and Explore"]
  node_vst["Variance Stabilization<br/>[vst.R]"]
  node_rlog["Regularized Log<br/>[rlog.R]"]
  node_plots["Plots<br/>[plots.R]"]
  node_transforms["Count Transforms<br/>[wrappers.R]"]
end

node_analyst(("Analyst"))
node_counts["Counts and Metadata"]

node_analyst -->|"provides"| node_counts
node_counts -->|"constructs"| node_dataset
node_analyst -->|"runs"| node_workflow
node_dataset -->|"analyzed by"| node_workflow
node_workflow -->|"estimates"| node_normalization
node_workflow -->|"estimates"| node_dispersion
node_workflow -->|"fits"| node_glm
node_dispersion -->|"calls"| node_cpp
node_glm -->|"calls"| node_cpp
node_workflow -->|"runs"| node_wald
node_workflow -->|"runs"| node_lrt
node_wald -->|"produces"| node_results
node_lrt -->|"produces"| node_results
node_results -->|"refines"| node_shrink
node_analyst -->|"requests"| node_vst
node_analyst -->|"requests"| node_rlog
node_dataset -->|"transforms"| node_vst
node_dataset -->|"transforms"| node_rlog
node_dataset -->|"transforms"| node_transforms
node_analyst -->|"requests"| node_plots
node_results -->|"visualizes"| node_plots
node_vst -->|"visualizes"| node_plots
node_rlog -->|"visualizes"| node_plots

click node_dataset "https://github.com/thelovelab/deseq2/blob/devel/R/AllClasses.R"
click node_workflow "https://github.com/thelovelab/deseq2/blob/devel/R/core.R"
click node_normalization "https://github.com/thelovelab/deseq2/blob/devel/R/core.R"
click node_dispersion "https://github.com/thelovelab/deseq2/blob/devel/R/core.R"
click node_glm "https://github.com/thelovelab/deseq2/blob/devel/R/fitNbinomGLMs.R"
click node_cpp "https://github.com/thelovelab/deseq2/blob/devel/src/DESeq2.cpp"
click node_wald "https://github.com/thelovelab/deseq2/blob/devel/R/core.R"
click node_lrt "https://github.com/thelovelab/deseq2/blob/devel/R/core.R"
click node_results "https://github.com/thelovelab/deseq2/blob/devel/R/results.R"
click node_shrink "https://github.com/thelovelab/deseq2/blob/devel/R/lfcShrink.R"
click node_vst "https://github.com/thelovelab/deseq2/blob/devel/R/vst.R"
click node_rlog "https://github.com/thelovelab/deseq2/blob/devel/R/rlog.R"
click node_plots "https://github.com/thelovelab/deseq2/blob/devel/R/plots.R"
click node_transforms "https://github.com/thelovelab/deseq2/blob/devel/R/wrappers.R"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset,node_workflow toneBlue
class node_normalization,node_dispersion,node_glm,node_cpp toneAmber
class node_wald,node_lrt,node_results,node_shrink toneMint
class node_vst,node_rlog,node_plots,node_transforms toneRose
class node_analyst,node_counts toneIndigo
```

## Components

### Data and Workflow

- [DESeqDataSet](https://github.com/thelovelab/deseq2/blob/devel/R/AllClasses.R): `R/AllClasses.R`
- [DESeq Workflow](https://github.com/thelovelab/deseq2/blob/devel/R/core.R): `R/core.R`

### Model Fitting

- [Size Factors](https://github.com/thelovelab/deseq2/blob/devel/R/core.R): `R/core.R`
- [Dispersion Estimation](https://github.com/thelovelab/deseq2/blob/devel/R/core.R): `R/core.R`
- [Negative Binomial GLMs](https://github.com/thelovelab/deseq2/blob/devel/R/fitNbinomGLMs.R): `R/fitNbinomGLMs.R`
- [Numerical Fitting](https://github.com/thelovelab/deseq2/blob/devel/src/DESeq2.cpp): `src/DESeq2.cpp`

### Inference

- [Wald Test](https://github.com/thelovelab/deseq2/blob/devel/R/core.R): `R/core.R`
- [Likelihood Ratio Test](https://github.com/thelovelab/deseq2/blob/devel/R/core.R): `R/core.R`
- [Result Extraction](https://github.com/thelovelab/deseq2/blob/devel/R/results.R): `R/results.R`
- [Fold Change Shrinkage](https://github.com/thelovelab/deseq2/blob/devel/R/lfcShrink.R): `R/lfcShrink.R`

### Transform and Explore

- [Variance Stabilization](https://github.com/thelovelab/deseq2/blob/devel/R/vst.R): `R/vst.R`
- [Regularized Log](https://github.com/thelovelab/deseq2/blob/devel/R/rlog.R): `R/rlog.R`
- [Plots](https://github.com/thelovelab/deseq2/blob/devel/R/plots.R): `R/plots.R`
- [Count Transforms](https://github.com/thelovelab/deseq2/blob/devel/R/wrappers.R): `R/wrappers.R`

### Other components

- **Analyst**
- **Counts and Metadata**

## Connections

- Analyst → Counts and Metadata: provides
- Counts and Metadata → DESeqDataSet: constructs
- Analyst → DESeq Workflow: runs
- DESeqDataSet → DESeq Workflow: analyzed by
- DESeq Workflow → Size Factors: estimates
- DESeq Workflow → Dispersion Estimation: estimates
- DESeq Workflow → Negative Binomial GLMs: fits
- Dispersion Estimation → Numerical Fitting: calls
- Negative Binomial GLMs → Numerical Fitting: calls
- DESeq Workflow → Wald Test: runs
- DESeq Workflow → Likelihood Ratio Test: runs
- Wald Test → Result Extraction: produces
- Likelihood Ratio Test → Result Extraction: produces
- Result Extraction → Fold Change Shrinkage: refines
- Analyst → Variance Stabilization: requests
- Analyst → Regularized Log: requests
- DESeqDataSet → Variance Stabilization: transforms
- DESeqDataSet → Regularized Log: transforms
- DESeqDataSet → Count Transforms: transforms
- Analyst → Plots: requests
- Result Extraction → Plots: visualizes
- Variance Stabilization → Plots: visualizes
- Regularized Log → Plots: visualizes
