# labgem/pan2met architecture

> Architecture diagram of the GitHub repository labgem/pan2met, 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/pan2met
- Repository: https://github.com/labgem/pan2met
- Video tour (about a minute): https://gitdiagram.com/labgem/pan2met/video

## Overview

pan2met is a Python library and CLI for inferring metabolic pathways and related pangenome-scale results from reaction, protein, and pangenome inputs. The principal workflow accepts catalyzed reactions, consults a configured metabolism knowledge base, applies pathway-inference rules, and writes inferred pathways. The CLI also exposes reactome, reverse-reactome, protein-complex, and pathway-operon-filler operations; the package includes pangenome analysis and genomic-context capabilities. Edges follow shown CLI dispatches, imports, and documented behavior; unsampled implementations are represented only where the tree and index establish a subsystem.

Main entry points: [`src/pan2met/__main__.py`](https://github.com/labgem/pan2met/blob/main/src/pan2met/__main__.py) (Command dispatcher), [`src/pan2met/io/knowledge_base/__init__.py`](https://github.com/labgem/pan2met/blob/main/src/pan2met/io/knowledge_base/__init__.py) (Knowledge base API), [`src/pan2met/inference/rulekit/metabolism.py`](https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/rulekit/metabolism.py) (Rule-based metabolism), [`src/pan2met/inference/reactome.py`](https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/reactome.py) (Reactome inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and configuration"]
  node_cli["Command dispatcher<br/>[__main__.py]"]
  node_config["Configuration<br/>[config.py]"]
end

subgraph group_reference["Knowledge base"]
  node_kb_api["Knowledge base API<br/>[__init__.py]"]
  node_metabiantes["MetaBiantes adapter<br/>[metabiantes.py]"]
  node_padmet["PADMet adapter<br/>[padmet.py]"]
  node_biopax["BioPAX adapter<br/>[biopax_folder.py]"]
end

subgraph group_inference["Metabolic inference"]
  node_reactome["Reactome inference<br/>[reactome.py]"]
  node_minpath["MinPath inference<br/>[minpath.py]"]
  node_rulekit_metabolism["Rule-based metabolism<br/>[metabolism.py]"]
  node_rule_engine["Rule engine<br/>[rulekit.py]"]
  node_complex["Protein complexes<br/>[proteic_complex.py]"]
  node_taxonomy["NCBI taxonomy<br/>[taxonomy.py]"]
end

subgraph group_pangenome["Pangenome analysis"]
  node_operon_filler["Pathway operon filler"]
  node_genomic_context["Genomic context<br/>[genomic_context.py]"]
  node_pangenome_io["Pangenome input<br/>[pangenome.py]"]
  node_analysis["Pangenome analyses"]
end

node_user(("User"))

node_user -->|"runs command"| node_cli
node_cli -->|"loads configuration"| node_config
node_cli -->|"dispatches inference"| node_reactome
node_cli -->|"dispatches inference"| node_minpath
node_cli -->|"dispatches inference"| node_rulekit_metabolism
node_cli -->|"dispatches inference"| node_complex
node_cli -->|"dispatches analysis"| node_operon_filler
node_config -->|"configures backend"| node_kb_api
node_kb_api -->|"selects backend"| node_metabiantes
node_kb_api -->|"selects backend"| node_padmet
node_kb_api -->|"selects backend"| node_biopax
node_reactome -->|"queries reactions"| node_kb_api
node_minpath -->|"queries pathways"| node_kb_api
node_rulekit_metabolism -->|"queries pathway data"| node_kb_api
node_rulekit_metabolism -->|"uses rules"| node_rule_engine
node_rulekit_metabolism -->|"uses taxonomic range"| node_taxonomy
node_reactome -->|"infers complexes"| node_complex
node_complex -->|"queries components"| node_kb_api
node_operon_filler -->|"uses context search"| node_genomic_context
node_cli -.->|"reads pangenome inputs"| node_pangenome_io
node_pangenome_io -.->|"supplies analysis data"| node_analysis

click node_cli "https://github.com/labgem/pan2met/blob/main/src/pan2met/__main__.py"
click node_config "https://github.com/labgem/pan2met/blob/main/src/pan2met/config.py"
click node_kb_api "https://github.com/labgem/pan2met/blob/main/src/pan2met/io/knowledge_base/__init__.py"
click node_metabiantes "https://github.com/labgem/pan2met/blob/main/src/pan2met/io/knowledge_base/metabiantes.py"
click node_padmet "https://github.com/labgem/pan2met/blob/main/src/pan2met/io/knowledge_base/padmet.py"
click node_biopax "https://github.com/labgem/pan2met/blob/main/src/pan2met/io/knowledge_base/biopax_folder.py"
click node_reactome "https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/reactome.py"
click node_minpath "https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/minpath/minpath.py"
click node_rulekit_metabolism "https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/rulekit/metabolism.py"
click node_rule_engine "https://github.com/labgem/pan2met/blob/main/src/pan2met/rulekit/rulekit.py"
click node_complex "https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/proteic_complex.py"
click node_operon_filler "https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/pathway_operon_filler.py"
click node_genomic_context "https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/genomic_context.py"
click node_pangenome_io "https://github.com/labgem/pan2met/blob/main/src/pan2met/io/pangenome.py"
click node_analysis "https://github.com/labgem/pan2met/tree/main/src/pan2met/analysis"
click node_taxonomy "https://github.com/labgem/pan2met/blob/main/src/pan2met/taxonomy.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_config,node_user toneBlue
class node_kb_api,node_metabiantes,node_padmet,node_biopax toneAmber
class node_reactome,node_minpath,node_rulekit_metabolism,node_rule_engine,node_complex,node_taxonomy toneMint
class node_operon_filler,node_genomic_context,node_pangenome_io,node_analysis toneRose
```

## Components

### CLI and configuration

- [Command dispatcher](https://github.com/labgem/pan2met/blob/main/src/pan2met/__main__.py): `src/pan2met/__main__.py`
- [Configuration](https://github.com/labgem/pan2met/blob/main/src/pan2met/config.py): `src/pan2met/config.py`

### Knowledge base

- [Knowledge base API](https://github.com/labgem/pan2met/blob/main/src/pan2met/io/knowledge_base/__init__.py): `src/pan2met/io/knowledge_base/__init__.py`
- [MetaBiantes adapter](https://github.com/labgem/pan2met/blob/main/src/pan2met/io/knowledge_base/metabiantes.py): `src/pan2met/io/knowledge_base/metabiantes.py`
- [PADMet adapter](https://github.com/labgem/pan2met/blob/main/src/pan2met/io/knowledge_base/padmet.py): `src/pan2met/io/knowledge_base/padmet.py`
- [BioPAX adapter](https://github.com/labgem/pan2met/blob/main/src/pan2met/io/knowledge_base/biopax_folder.py): `src/pan2met/io/knowledge_base/biopax_folder.py`

### Metabolic inference

- [Reactome inference](https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/reactome.py): `src/pan2met/inference/reactome.py`
- [MinPath inference](https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/minpath/minpath.py): `src/pan2met/inference/minpath/minpath.py`
- [Rule-based metabolism](https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/rulekit/metabolism.py): `src/pan2met/inference/rulekit/metabolism.py`
- [Rule engine](https://github.com/labgem/pan2met/blob/main/src/pan2met/rulekit/rulekit.py): `src/pan2met/rulekit/rulekit.py`
- [Protein complexes](https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/proteic_complex.py): `src/pan2met/inference/proteic_complex.py`
- [NCBI taxonomy](https://github.com/labgem/pan2met/blob/main/src/pan2met/taxonomy.py): `src/pan2met/taxonomy.py`

### Pangenome analysis

- [Pathway operon filler](https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/pathway_operon_filler.py): `src/pan2met/inference/pathway_operon_filler.py`
- [Genomic context](https://github.com/labgem/pan2met/blob/main/src/pan2met/inference/genomic_context.py): `src/pan2met/inference/genomic_context.py`
- [Pangenome input](https://github.com/labgem/pan2met/blob/main/src/pan2met/io/pangenome.py): `src/pan2met/io/pangenome.py`
- [Pangenome analyses](https://github.com/labgem/pan2met/tree/main/src/pan2met/analysis): `src/pan2met/analysis`

### Other components

- **User**

## Connections

- User → Command dispatcher: runs command (evidence: `README.md`)
- Command dispatcher → Configuration: loads configuration (evidence: `src/pan2met/__main__.py`)
- Command dispatcher → Reactome inference: dispatches inference (evidence: `src/pan2met/__main__.py`)
- Command dispatcher → MinPath inference: dispatches inference (evidence: `src/pan2met/__main__.py`)
- Command dispatcher → Rule-based metabolism: dispatches inference (evidence: `src/pan2met/__main__.py`)
- Command dispatcher → Protein complexes: dispatches inference (evidence: `src/pan2met/__main__.py`)
- Command dispatcher → Pathway operon filler: dispatches analysis (evidence: `src/pan2met/__main__.py`)
- Configuration → Knowledge base API: configures backend (evidence: `src/pan2met/config.py`)
- Knowledge base API → MetaBiantes adapter: selects backend (evidence: `src/pan2met/io/knowledge_base/__init__.py`)
- Knowledge base API → PADMet adapter: selects backend (evidence: `src/pan2met/io/knowledge_base/__init__.py`)
- Knowledge base API → BioPAX adapter: selects backend (evidence: `src/pan2met/io/knowledge_base/__init__.py`)
- Reactome inference → Knowledge base API: queries reactions (evidence: `src/pan2met/inference/reactome.py`)
- MinPath inference → Knowledge base API: queries pathways (evidence: `src/pan2met/inference/minpath/minpath.py`)
- Rule-based metabolism → Knowledge base API: queries pathway data (evidence: `src/pan2met/inference/rulekit/metabolism.py`)
- Rule-based metabolism → Rule engine: uses rules (evidence: `src/pan2met/inference/rulekit/metabolism.py`)
- Rule-based metabolism → NCBI taxonomy: uses taxonomic range (evidence: `src/pan2met/inference/rulekit/metabolism.py`)
- Reactome inference → Protein complexes: infers complexes (evidence: `src/pan2met/inference/reactome.py`)
- Protein complexes → Knowledge base API: queries components (evidence: `src/pan2met/inference/proteic_complex.py`)
- Pathway operon filler → Genomic context: uses context search (evidence: `src/pan2met/inference/pathway_operon_filler.py`)
- Command dispatcher → Pangenome input: reads pangenome inputs
- Pangenome input → Pangenome analyses: supplies analysis data (evidence: `src/pan2met/analysis/completion_pangenome.py`)
