# labgem/ppanggolin architecture

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

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

## Overview

PPanGGOLiN creates and analyzes prokaryotic pangenomes, principally through a workflow that turns genome sequences or annotations into gene families, a neighborhood graph, and statistical partitions, then predicts RGPs, insertion spots, and conserved modules. The resulting pangenome can be persisted and reused for exports, visualization, and further analyses. Workflow capabilities and several module relationships are documented in the README or SOURCE INDEX; unsampled implementation details are not used to infer additional call paths.

Main entry points: [`ppanggolin/main.py`](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/main.py) (Command interface), [`ppanggolin/workflow/all.py`](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/workflow/all.py) (Complete workflow), [`ppanggolin/pangenome.py`](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/pangenome.py) (Pangenome model), [`ppanggolin/projection/projection.py`](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/projection/projection.py) (Pangenome projection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Pangenome analysis"]
  node_cli["Command interface<br/>[main.py]"]
  node_workflow["Complete workflow<br/>[all.py]"]
  node_annotate["Genome annotation<br/>[annotate.py]"]
  node_cluster["Gene clustering<br/>[cluster.py]"]
  node_graph["Neighborhood graph<br/>[makeGraph.py]"]
  node_partition["Statistical partitioning<br/>[partition.py]"]
end

subgraph group_domain["Pangenome model"]
  node_model["Pangenome model<br/>[pangenome.py]"]
  node_genome["Genome features<br/>[genome.py]"]
  node_families["Gene families<br/>[geneFamily.py]"]
end

subgraph group_extensions["Additional analyses"]
  node_rgp["RGP prediction<br/>[genomicIsland.py]"]
  node_spots["Insertion spots<br/>[spot.py]"]
  node_modules["Conserved modules<br/>[module.py]"]
  node_projection["Pangenome projection<br/>[projection.py]"]
  node_alignment["Sequence alignment<br/>[alignOnPang.py]"]
  node_context["Gene context search"]
  node_metrics["Pangenome metrics<br/>[metrics.py]"]
end

subgraph group_outputs["Persistence and outputs"]
  node_hdf[("HDF5 pangenome<br/>[writeBinaries.py]")]
  node_reader["Pangenome loading<br/>[readBinaries.py]"]
  node_flat["Flat-file export"]
  node_genome_export["Genome export"]
  node_sequences["Sequence export<br/>[writeSequences.py]"]
  node_figures["Pangenome figures<br/>[drawing.py]"]
end

node_user(("Researcher"))

node_user -->|"runs commands"| node_cli
node_cli -->|"dispatches workflow"| node_workflow
node_workflow -->|"invokes annotation"| node_annotate
node_workflow -->|"invokes clustering"| node_cluster
node_workflow -->|"builds graph"| node_graph
node_workflow -->|"partitions families"| node_partition
node_workflow -->|"predicts RGPs"| node_rgp
node_workflow -->|"predicts spots"| node_spots
node_workflow -->|"predicts modules"| node_modules
node_annotate -->|"creates features"| node_genome
node_cluster -->|"forms families"| node_families
node_graph -->|"adds graph edges"| node_model
node_partition -->|"assigns partitions"| node_families
node_rgp -->|"reads pangenome"| node_model
node_spots -->|"reads pangenome"| node_model
node_modules -->|"reads pangenome"| node_model
node_workflow -->|"writes results"| node_hdf
node_hdf -->|"loads saved data"| node_reader
node_reader -->|"populates model"| node_model
node_cli -->|"dispatches projection"| node_projection
node_projection -->|"reuses annotation"| node_annotate
node_projection -->|"reuses alignment"| node_alignment
node_cli -->|"dispatches search"| node_context
node_context -->|"uses alignment"| node_alignment
node_cli -->|"dispatches metrics"| node_metrics
node_metrics -->|"analyzes pangenome"| node_model
node_cli -->|"dispatches export"| node_flat
node_flat -->|"loads source data"| node_reader
node_cli -->|"dispatches export"| node_genome_export
node_cli -->|"dispatches export"| node_sequences
node_cli -->|"dispatches drawing"| node_figures

click node_cli "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/main.py"
click node_workflow "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/workflow/all.py"
click node_annotate "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/annotate/annotate.py"
click node_cluster "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/cluster/cluster.py"
click node_graph "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/graph/makeGraph.py"
click node_partition "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/nem/partition.py"
click node_model "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/pangenome.py"
click node_genome "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/genome.py"
click node_families "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/geneFamily.py"
click node_rgp "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/RGP/genomicIsland.py"
click node_spots "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/RGP/spot.py"
click node_modules "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/mod/module.py"
click node_projection "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/projection/projection.py"
click node_alignment "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/align/alignOnPang.py"
click node_context "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/context/searchGeneContext.py"
click node_metrics "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/metrics/metrics.py"
click node_hdf "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/formats/writeBinaries.py"
click node_reader "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/formats/readBinaries.py"
click node_flat "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/formats/writeFlatPangenome.py"
click node_genome_export "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/formats/writeFlatGenomes.py"
click node_sequences "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/formats/writeSequences.py"
click node_figures "https://github.com/labgem/ppanggolin/blob/master/ppanggolin/figures/drawing.py"

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_workflow,node_annotate,node_cluster,node_graph,node_partition toneBlue
class node_model,node_genome,node_families toneAmber
class node_rgp,node_spots,node_modules,node_projection,node_alignment,node_context,node_metrics toneMint
class node_hdf,node_reader,node_flat,node_genome_export,node_sequences,node_figures toneRose
class node_user toneIndigo
```

## Components

### Pangenome analysis

- [Command interface](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/main.py): `ppanggolin/main.py`
- [Complete workflow](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/workflow/all.py): `ppanggolin/workflow/all.py`
- [Genome annotation](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/annotate/annotate.py): `ppanggolin/annotate/annotate.py`
- [Gene clustering](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/cluster/cluster.py): `ppanggolin/cluster/cluster.py`
- [Neighborhood graph](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/graph/makeGraph.py): `ppanggolin/graph/makeGraph.py`
- [Statistical partitioning](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/nem/partition.py): `ppanggolin/nem/partition.py`

### Pangenome model

- [Pangenome model](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/pangenome.py): `ppanggolin/pangenome.py`
- [Genome features](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/genome.py): `ppanggolin/genome.py`
- [Gene families](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/geneFamily.py): `ppanggolin/geneFamily.py`

### Additional analyses

- [RGP prediction](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/RGP/genomicIsland.py): `ppanggolin/RGP/genomicIsland.py`
- [Insertion spots](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/RGP/spot.py): `ppanggolin/RGP/spot.py`
- [Conserved modules](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/mod/module.py): `ppanggolin/mod/module.py`
- [Pangenome projection](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/projection/projection.py): `ppanggolin/projection/projection.py`
- [Sequence alignment](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/align/alignOnPang.py): `ppanggolin/align/alignOnPang.py`
- [Gene context search](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/context/searchGeneContext.py): `ppanggolin/context/searchGeneContext.py`
- [Pangenome metrics](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/metrics/metrics.py): `ppanggolin/metrics/metrics.py`

### Persistence and outputs

- [HDF5 pangenome](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/formats/writeBinaries.py): `ppanggolin/formats/writeBinaries.py`
- [Pangenome loading](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/formats/readBinaries.py): `ppanggolin/formats/readBinaries.py`
- [Flat-file export](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/formats/writeFlatPangenome.py): `ppanggolin/formats/writeFlatPangenome.py`
- [Genome export](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/formats/writeFlatGenomes.py): `ppanggolin/formats/writeFlatGenomes.py`
- [Sequence export](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/formats/writeSequences.py): `ppanggolin/formats/writeSequences.py`
- [Pangenome figures](https://github.com/labgem/ppanggolin/blob/master/ppanggolin/figures/drawing.py): `ppanggolin/figures/drawing.py`

### Other components

- **Researcher**

## Connections

- Researcher → Command interface: runs commands (evidence: `README.md`)
- Command interface → Complete workflow: dispatches workflow (evidence: `ppanggolin/main.py`)
- Complete workflow → Genome annotation: invokes annotation (evidence: `ppanggolin/workflow/all.py`)
- Complete workflow → Gene clustering: invokes clustering (evidence: `ppanggolin/workflow/all.py`)
- Complete workflow → Neighborhood graph: builds graph (evidence: `ppanggolin/workflow/all.py`)
- Complete workflow → Statistical partitioning: partitions families (evidence: `ppanggolin/workflow/all.py`)
- Complete workflow → RGP prediction: predicts RGPs (evidence: `ppanggolin/workflow/all.py`)
- Complete workflow → Insertion spots: predicts spots (evidence: `ppanggolin/workflow/all.py`)
- Complete workflow → Conserved modules: predicts modules (evidence: `README.md`)
- Genome annotation → Genome features: creates features (evidence: `ppanggolin/annotate/annotate.py`)
- Gene clustering → Gene families: forms families (evidence: `ppanggolin/cluster/cluster.py`)
- Neighborhood graph → Pangenome model: adds graph edges (evidence: `ppanggolin/graph/makeGraph.py`)
- Statistical partitioning → Gene families: assigns partitions (evidence: `ppanggolin/nem/partition.py`)
- RGP prediction → Pangenome model: reads pangenome (evidence: `ppanggolin/RGP/genomicIsland.py`)
- Insertion spots → Pangenome model: reads pangenome (evidence: `ppanggolin/RGP/spot.py`)
- Conserved modules → Pangenome model: reads pangenome (evidence: `ppanggolin/mod/module.py`)
- Complete workflow → HDF5 pangenome: writes results (evidence: `ppanggolin/workflow/all.py`)
- HDF5 pangenome → Pangenome loading: loads saved data (evidence: `ppanggolin/formats/readBinaries.py`)
- Pangenome loading → Pangenome model: populates model (evidence: `ppanggolin/formats/readBinaries.py`)
- Command interface → Pangenome projection: dispatches projection (evidence: `ppanggolin/main.py`)
- Pangenome projection → Genome annotation: reuses annotation (evidence: `ppanggolin/projection/projection.py`)
- Pangenome projection → Sequence alignment: reuses alignment (evidence: `ppanggolin/projection/projection.py`)
- Command interface → Gene context search: dispatches search (evidence: `ppanggolin/main.py`)
- Gene context search → Sequence alignment: uses alignment (evidence: `ppanggolin/context/searchGeneContext.py`)
- Command interface → Pangenome metrics: dispatches metrics (evidence: `ppanggolin/main.py`)
- Pangenome metrics → Pangenome model: analyzes pangenome (evidence: `ppanggolin/metrics/metrics.py`)
- Command interface → Flat-file export: dispatches export (evidence: `ppanggolin/main.py`)
- Flat-file export → Pangenome loading: loads source data (evidence: `ppanggolin/formats/writeFlatPangenome.py`)
- Command interface → Genome export: dispatches export (evidence: `ppanggolin/main.py`)
- Command interface → Sequence export: dispatches export (evidence: `ppanggolin/main.py`)
- Command interface → Pangenome figures: dispatches drawing (evidence: `ppanggolin/main.py`)
