# oschwengers/bakta architecture

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

- Interactive diagram: https://gitdiagram.com/oschwengers/bakta
- Repository: https://github.com/oschwengers/bakta

## Overview

Bakta is a local bacterial-genome and plasmid annotation tool. A user supplies FASTA and receives standardized feature annotations in machine-readable and bioinformatics-standard formats. The workflow includes sequence preparation, feature detection, protein matching and expert annotation, then annotation reconciliation and output writing. The graph preserves documented feature types, protein-identification methods, expert systems, and plotting. Orchestration links are based on the main-module reference index; where implementation details were not excerpted, the graph avoids inferring finer-grained calls.

Main entry points: [`bakta/main.py`](https://github.com/oschwengers/bakta/blob/main/bakta/main.py) (Annotation runner), [`bakta/features/s_orf.py`](https://github.com/oschwengers/bakta/blob/main/bakta/features/s_orf.py) (sORF detection), [`bakta/features/cds.py`](https://github.com/oschwengers/bakta/blob/main/bakta/features/cds.py) (CDS annotation), [`bakta/features/orf.py`](https://github.com/oschwengers/bakta/blob/main/bakta/features/orf.py) (ORF processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Workflow &amp; sequence"]
  node_main["Annotation runner<br/>[main.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_fasta["FASTA handling<br/>[fasta.py]"]
  node_database[("Annotation database<br/>[db.py]")]
end

subgraph group_features["Feature detection"]
  node_orf["ORF processing<br/>[orf.py]"]
  node_cds["CDS annotation<br/>[cds.py]"]
  node_small["sORF detection<br/>[s_orf.py]"]
  node_rna["RNA genes"]
  node_crispr["CRISPR arrays<br/>[crispr.py]"]
  node_ncregion["Regulatory regions<br/>[nc_rna_region.py]"]
  node_ori["Replication origins<br/>[ori.py]"]
  node_gaps["Assembly gaps<br/>[gaps.py]"]
  node_reconcile["Feature reconciliation<br/>[annotation.py]"]
end

subgraph group_protein["Protein annotation"]
  node_ips["Exact protein IDs<br/>[ips.py]"]
  node_ups["UniParc lookup<br/>[ups.py]"]
  node_psc["Protein clusters<br/>[psc.py]"]
  node_pscc["Cluster cross-reference<br/>[pscc.py]"]
  node_experts["Expert systems"]
end

subgraph group_outputs["Results &amp; visualization"]
  node_json["JSON results<br/>[json.py]"]
  node_gff["GFF3 output<br/>[gff.py]"]
  node_insdc["INSDC output<br/>[insdc.py]"]
  node_tsv["TSV output<br/>[tsv.py]"]
  node_plot["Genome plots<br/>[plot.py]"]
end

node_user(("Genome user"))

node_user -->|"submits genome"| node_main
node_main -->|"configures run"| node_config
node_main -->|"reads sequences"| node_fasta
node_main -->|"loads database"| node_database
node_main -->|"predicts ORFs"| node_orf
node_main -->|"annotates CDS"| node_cds
node_main -->|"detects sORFs"| node_small
node_main -->|"detects RNA genes"| node_rna
node_main -->|"detects CRISPR"| node_crispr
node_main -->|"detects regions"| node_ncregion
node_main -->|"detects origins"| node_ori
node_main -->|"marks gaps"| node_gaps
node_main -->|"identifies proteins"| node_ips
node_main -->|"looks up proteins"| node_ups
node_main -->|"matches clusters"| node_psc
node_main -->|"matches clusters"| node_pscc
node_main -->|"runs expert systems"| node_experts
node_cds -->|"uses ORFs"| node_orf
node_small -->|"looks up clusters"| node_psc
node_small -->|"looks up clusters"| node_pscc
node_main -->|"reconciles features"| node_reconcile
node_main -->|"writes JSON"| node_json
node_main -->|"writes GFF3"| node_gff
node_main -->|"writes INSDC"| node_insdc
node_main -->|"writes TSV"| node_tsv
node_main -.->|"creates plots"| node_plot

click node_main "https://github.com/oschwengers/bakta/blob/main/bakta/main.py"
click node_config "https://github.com/oschwengers/bakta/blob/main/bakta/config.py"
click node_fasta "https://github.com/oschwengers/bakta/blob/main/bakta/io/fasta.py"
click node_database "https://github.com/oschwengers/bakta/blob/main/bakta/db.py"
click node_orf "https://github.com/oschwengers/bakta/blob/main/bakta/features/orf.py"
click node_cds "https://github.com/oschwengers/bakta/blob/main/bakta/features/cds.py"
click node_small "https://github.com/oschwengers/bakta/blob/main/bakta/features/s_orf.py"
click node_rna "https://github.com/oschwengers/bakta/tree/main/bakta/features"
click node_crispr "https://github.com/oschwengers/bakta/blob/main/bakta/features/crispr.py"
click node_ncregion "https://github.com/oschwengers/bakta/blob/main/bakta/features/nc_rna_region.py"
click node_ori "https://github.com/oschwengers/bakta/blob/main/bakta/features/ori.py"
click node_gaps "https://github.com/oschwengers/bakta/blob/main/bakta/features/gaps.py"
click node_reconcile "https://github.com/oschwengers/bakta/blob/main/bakta/features/annotation.py"
click node_ips "https://github.com/oschwengers/bakta/blob/main/bakta/ips.py"
click node_ups "https://github.com/oschwengers/bakta/blob/main/bakta/ups.py"
click node_psc "https://github.com/oschwengers/bakta/blob/main/bakta/psc.py"
click node_pscc "https://github.com/oschwengers/bakta/blob/main/bakta/pscc.py"
click node_experts "https://github.com/oschwengers/bakta/tree/main/bakta/expert"
click node_json "https://github.com/oschwengers/bakta/blob/main/bakta/io/json.py"
click node_gff "https://github.com/oschwengers/bakta/blob/main/bakta/io/gff.py"
click node_insdc "https://github.com/oschwengers/bakta/blob/main/bakta/io/insdc.py"
click node_tsv "https://github.com/oschwengers/bakta/blob/main/bakta/io/tsv.py"
click node_plot "https://github.com/oschwengers/bakta/blob/main/bakta/plot.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_main,node_config,node_fasta,node_database,node_user toneBlue
class node_orf,node_cds,node_small,node_rna,node_crispr,node_ncregion,node_ori,node_gaps,node_reconcile toneAmber
class node_ips,node_ups,node_psc,node_pscc,node_experts toneMint
class node_json,node_gff,node_insdc,node_tsv,node_plot toneRose
```

## Components

### Workflow & sequence

- [Annotation runner](https://github.com/oschwengers/bakta/blob/main/bakta/main.py): `bakta/main.py`
- [Runtime configuration](https://github.com/oschwengers/bakta/blob/main/bakta/config.py): `bakta/config.py`
- [FASTA handling](https://github.com/oschwengers/bakta/blob/main/bakta/io/fasta.py): `bakta/io/fasta.py`
- [Annotation database](https://github.com/oschwengers/bakta/blob/main/bakta/db.py): `bakta/db.py`

### Feature detection

- [ORF processing](https://github.com/oschwengers/bakta/blob/main/bakta/features/orf.py): `bakta/features/orf.py`
- [CDS annotation](https://github.com/oschwengers/bakta/blob/main/bakta/features/cds.py): `bakta/features/cds.py`
- [sORF detection](https://github.com/oschwengers/bakta/blob/main/bakta/features/s_orf.py): `bakta/features/s_orf.py`
- [RNA genes](https://github.com/oschwengers/bakta/tree/main/bakta/features): `bakta/features`
- [CRISPR arrays](https://github.com/oschwengers/bakta/blob/main/bakta/features/crispr.py): `bakta/features/crispr.py`
- [Regulatory regions](https://github.com/oschwengers/bakta/blob/main/bakta/features/nc_rna_region.py): `bakta/features/nc_rna_region.py`
- [Replication origins](https://github.com/oschwengers/bakta/blob/main/bakta/features/ori.py): `bakta/features/ori.py`
- [Assembly gaps](https://github.com/oschwengers/bakta/blob/main/bakta/features/gaps.py): `bakta/features/gaps.py`
- [Feature reconciliation](https://github.com/oschwengers/bakta/blob/main/bakta/features/annotation.py): `bakta/features/annotation.py`

### Protein annotation

- [Exact protein IDs](https://github.com/oschwengers/bakta/blob/main/bakta/ips.py): `bakta/ips.py`
- [UniParc lookup](https://github.com/oschwengers/bakta/blob/main/bakta/ups.py): `bakta/ups.py`
- [Protein clusters](https://github.com/oschwengers/bakta/blob/main/bakta/psc.py): `bakta/psc.py`
- [Cluster cross-reference](https://github.com/oschwengers/bakta/blob/main/bakta/pscc.py): `bakta/pscc.py`
- [Expert systems](https://github.com/oschwengers/bakta/tree/main/bakta/expert): `bakta/expert`

### Results & visualization

- [JSON results](https://github.com/oschwengers/bakta/blob/main/bakta/io/json.py): `bakta/io/json.py`
- [GFF3 output](https://github.com/oschwengers/bakta/blob/main/bakta/io/gff.py): `bakta/io/gff.py`
- [INSDC output](https://github.com/oschwengers/bakta/blob/main/bakta/io/insdc.py): `bakta/io/insdc.py`
- [TSV output](https://github.com/oschwengers/bakta/blob/main/bakta/io/tsv.py): `bakta/io/tsv.py`
- [Genome plots](https://github.com/oschwengers/bakta/blob/main/bakta/plot.py): `bakta/plot.py`

### Other components

- **Genome user**

## Connections

- Genome user → Annotation runner: submits genome
- Annotation runner → Runtime configuration: configures run (evidence: `bakta/main.py`)
- Annotation runner → FASTA handling: reads sequences (evidence: `bakta/main.py`)
- Annotation runner → Annotation database: loads database (evidence: `bakta/main.py`)
- Annotation runner → ORF processing: predicts ORFs (evidence: `bakta/main.py`)
- Annotation runner → CDS annotation: annotates CDS (evidence: `bakta/main.py`)
- Annotation runner → sORF detection: detects sORFs (evidence: `bakta/main.py`)
- Annotation runner → RNA genes: detects RNA genes (evidence: `bakta/main.py`)
- Annotation runner → CRISPR arrays: detects CRISPR (evidence: `bakta/main.py`)
- Annotation runner → Regulatory regions: detects regions (evidence: `bakta/main.py`)
- Annotation runner → Replication origins: detects origins (evidence: `bakta/main.py`)
- Annotation runner → Assembly gaps: marks gaps (evidence: `bakta/main.py`)
- Annotation runner → Exact protein IDs: identifies proteins (evidence: `bakta/main.py`)
- Annotation runner → UniParc lookup: looks up proteins (evidence: `bakta/main.py`)
- Annotation runner → Protein clusters: matches clusters (evidence: `bakta/main.py`)
- Annotation runner → Cluster cross-reference: matches clusters (evidence: `bakta/main.py`)
- Annotation runner → Expert systems: runs expert systems (evidence: `bakta/main.py`)
- CDS annotation → ORF processing: uses ORFs (evidence: `bakta/features/cds.py`)
- sORF detection → Protein clusters: looks up clusters (evidence: `bakta/features/s_orf.py`)
- sORF detection → Cluster cross-reference: looks up clusters (evidence: `bakta/features/s_orf.py`)
- Annotation runner → Feature reconciliation: reconciles features (evidence: `bakta/main.py`)
- Annotation runner → JSON results: writes JSON (evidence: `bakta/main.py`)
- Annotation runner → GFF3 output: writes GFF3 (evidence: `bakta/main.py`)
- Annotation runner → INSDC output: writes INSDC (evidence: `bakta/main.py`)
- Annotation runner → TSV output: writes TSV (evidence: `bakta/main.py`)
- Annotation runner → Genome plots: creates plots (evidence: `bakta/main.py`)
