# sciencestanley/methylation-pipeline architecture

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

- Interactive diagram: https://gitdiagram.com/sciencestanley/methylation-pipeline
- Repository: https://github.com/sciencestanley/methylation-pipeline

## Overview

This repository is a long-read DNA methylation analysis pipeline for rare-disease and clinical interpretation. Its user-facing workflow starts in either the command-line interface or the documented Jupyter notebook: sequence data is aligned and methylation is called, then downstream analysis identifies differentially methylated regions and supports gene- and variant-level interpretation. Core Python modules implement the CLI analysis and data access; the notebooks document broader QC, visualization, episignature matching, and reporting capabilities. Notebook-stage connections are based on README descriptions, not inspected notebook source.

Main entry points: [`methylation_cli/cli.py`](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_cli/cli.py) (Analysis CLI), [`methylation_pipeline_sections_3_7.ipynb`](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb) (Analysis sections), [`methylation_analysis_pipeline.ipynb`](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_analysis_pipeline.ipynb) (Guided notebook), [`methylation_core/variant_integrator.py`](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/variant_integrator.py) (Variant integration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["Analysis CLI<br/>[cli.py]"]
  node_notebook["Guided notebook"]
  node_notebook_sections["Analysis sections"]
end

subgraph group_processing["Sequence processing"]
  node_data_io["Data import/export<br/>[data_io.py]"]
  node_alignment["Read alignment<br/>[alignment.py]"]
  node_calling["Methylation calling"]
  node_qc["Quality control"]
end

subgraph group_analysis["Methylation analysis"]
  node_dmr["DMR analysis<br/>[dmr_finder.py]"]
  node_gene["Gene analysis<br/>[gene_analyzer.py]"]
end

subgraph group_interpretation["Clinical interpretation"]
  node_variant["Variant integration"]
  node_episignature["Episignature matching"]
  node_visualization["Interactive visualizations"]
end

subgraph group_persistence["Data and outputs"]
  node_database[("Methylation store<br/>[database.py]")]
  node_reporting["Clinical reporting"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs analysis"| node_cli
node_researcher -->|"starts workflow"| node_notebook
node_notebook -->|"continues analysis"| node_notebook_sections
node_cli -->|"invokes alignment"| node_alignment
node_cli -->|"invokes calling"| node_calling
node_cli -->|"invokes DMR analysis"| node_dmr
node_cli -->|"queries and stores"| node_database
node_cli -->|"invokes gene analysis"| node_gene
node_cli -->|"invokes integration"| node_variant
node_variant -->|"queries methylation"| node_database
node_notebook -.->|"imports data"| node_data_io
node_notebook -->|"runs quality checks"| node_qc
node_notebook -->|"aligns reads"| node_alignment
node_notebook -->|"calls methylation"| node_calling
node_notebook_sections -->|"identifies DMRs"| node_dmr
node_notebook_sections -.->|"analyzes genes"| node_gene
node_notebook_sections -->|"interprets variants"| node_variant
node_notebook_sections -->|"matches signatures"| node_episignature
node_notebook_sections -->|"presents analysis"| node_visualization
node_notebook_sections -->|"generates reports"| node_reporting

click node_cli "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_cli/cli.py"
click node_notebook "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_analysis_pipeline.ipynb"
click node_notebook_sections "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb"
click node_data_io "https://github.com/sciencestanley/methylation-pipeline/blob/main/utils/data_io.py"
click node_alignment "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/alignment.py"
click node_calling "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/methylation_caller.py"
click node_qc "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb"
click node_dmr "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/dmr_finder.py"
click node_gene "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/gene_analyzer.py"
click node_database "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/database.py"
click node_variant "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/variant_integrator.py"
click node_episignature "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb"
click node_visualization "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb"
click node_reporting "https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb"

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_cli,node_notebook,node_notebook_sections toneBlue
class node_data_io,node_alignment,node_calling,node_qc toneAmber
class node_dmr,node_gene toneMint
class node_variant,node_episignature,node_visualization toneRose
class node_database,node_reporting,node_researcher toneIndigo
```

## Components

### User entry points

- [Analysis CLI](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_cli/cli.py): `methylation_cli/cli.py`
- [Guided notebook](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_analysis_pipeline.ipynb): `methylation_analysis_pipeline.ipynb`
- [Analysis sections](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb): `methylation_pipeline_sections_3_7.ipynb`

### Sequence processing

- [Data import/export](https://github.com/sciencestanley/methylation-pipeline/blob/main/utils/data_io.py): `utils/data_io.py`
- [Read alignment](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/alignment.py): `methylation_core/alignment.py`
- [Methylation calling](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/methylation_caller.py): `methylation_core/methylation_caller.py`
- [Quality control](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb): `methylation_pipeline_sections_3_7.ipynb`

### Methylation analysis

- [DMR analysis](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/dmr_finder.py): `methylation_core/dmr_finder.py`
- [Gene analysis](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/gene_analyzer.py): `methylation_core/gene_analyzer.py`

### Clinical interpretation

- [Variant integration](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/variant_integrator.py): `methylation_core/variant_integrator.py`
- [Episignature matching](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb): `methylation_pipeline_sections_3_7.ipynb`
- [Interactive visualizations](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb): `methylation_pipeline_sections_3_7.ipynb`

### Data and outputs

- [Methylation store](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_core/database.py): `methylation_core/database.py`
- [Clinical reporting](https://github.com/sciencestanley/methylation-pipeline/blob/main/methylation_pipeline_sections_3_7.ipynb): `methylation_pipeline_sections_3_7.ipynb`

### Other components

- **Researcher**

## Connections

- Researcher → Analysis CLI: runs analysis (evidence: `README.md`)
- Researcher → Guided notebook: starts workflow (evidence: `README.md`)
- Guided notebook → Analysis sections: continues analysis (evidence: `README.md`)
- Analysis CLI → Read alignment: invokes alignment (evidence: `methylation_cli/cli.py`)
- Analysis CLI → Methylation calling: invokes calling (evidence: `methylation_cli/cli.py`)
- Analysis CLI → DMR analysis: invokes DMR analysis (evidence: `methylation_cli/cli.py`)
- Analysis CLI → Methylation store: queries and stores (evidence: `methylation_cli/cli.py`)
- Analysis CLI → Gene analysis: invokes gene analysis (evidence: `methylation_cli/cli.py`)
- Analysis CLI → Variant integration: invokes integration (evidence: `methylation_cli/cli.py`)
- Variant integration → Methylation store: queries methylation (evidence: `methylation_core/variant_integrator.py`)
- Guided notebook → Data import/export: imports data
- Guided notebook → Quality control: runs quality checks (evidence: `README.md`)
- Guided notebook → Read alignment: aligns reads (evidence: `README.md`)
- Guided notebook → Methylation calling: calls methylation (evidence: `README.md`)
- Analysis sections → DMR analysis: identifies DMRs (evidence: `README.md`)
- Analysis sections → Gene analysis: analyzes genes
- Analysis sections → Variant integration: interprets variants (evidence: `README.md`)
- Analysis sections → Episignature matching: matches signatures (evidence: `README.md`)
- Analysis sections → Interactive visualizations: presents analysis (evidence: `README.md`)
- Analysis sections → Clinical reporting: generates reports (evidence: `README.md`)
