# gaius-augustus/braker4 architecture

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

- Interactive diagram: https://gitdiagram.com/gaius-augustus/braker4
- Repository: https://github.com/gaius-augustus/braker4

## Overview

BRAKER4 is a Snakemake genome-annotation pipeline: users provide a genome and evidence, and it produces protein-coding gene predictions with optional functional annotation, non-coding RNA predictions, and quality assessments. The documented prediction stages are GeneMark training, AUGUSTUS training/prediction, and TSEBRA merging, with preprocessing and postprocessing around them. The graph retains substantial indexed scripts as implementation components; their precise rule-level wiring is not established by the excerpts. Edges reflect README-documented relationships, not uninspected rule calls.

Main entry points: [`Snakefile`](https://github.com/gaius-augustus/braker4/blob/main/Snakefile) (Snakemake workflow), [`samples.csv`](https://github.com/gaius-augustus/braker4/blob/main/samples.csv) (Sample inputs), [`config.ini.example`](https://github.com/gaius-augustus/braker4/blob/main/config.ini.example) (Run configuration), [`rules/postprocessing/run_tsebra.smk`](https://github.com/gaius-augustus/braker4/blob/main/rules/postprocessing/run_tsebra.smk) (TSEBRA merging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs and preprocessing"]
  node_inputs["Sample inputs<br/>[samples.csv]"]
  node_config["Run configuration<br/>[config.ini.example]"]
  node_prep["Genome and evidence prep"]
  node_varus["RNA-Seq selection<br/>[run_varus.smk]"]
end

subgraph group_prediction["Gene prediction"]
  node_workflow["Snakemake workflow"]
  node_genemark["GeneMark evidence training"]
  node_training["AUGUSTUS training"]
  node_augustus["AUGUSTUS prediction"]
  node_tsebra["TSEBRA merging<br/>[run_tsebra.smk]"]
  node_spaln["Spaln dispatcher"]
end

subgraph group_post["Postprocessing and outputs"]
  node_best["BUSCO gene rescue"]
  node_rescue["Agreement rescue"]
  node_normalize["Gene model normalization<br/>[normalize_gtf.py]"]
  node_stopfix["Stop-codon repair"]
  node_utr["UTR decoration<br/>[stringtie2utr.py]"]
  node_gff["GFF3 conversion"]
  node_ena["ENA export<br/>[gff3_to_ena.py]"]
  node_protein_fasta["Protein extraction"]
  node_output["Annotation results"]
end

subgraph group_quality["Quality and reporting"]
  node_hint["Hint support analysis"]
  node_support["Gene support summary"]
  node_stats["Gene set statistics"]
  node_report["Run report<br/>[generate_report.py]"]
  node_training_summary["Training summary"]
end

subgraph group_extras["Optional annotation"]
  node_ncrna["Noncoding RNA"]
  node_embeddings["Protein embeddings"]
  node_fantasia["FANTASIA summaries"]
  node_ncrna_merge["ncRNA result merge"]
end

node_user(("Annotation user"))

node_user -->|"provides samples"| node_inputs
node_user -->|"sets options"| node_config
node_inputs -->|"configures run"| node_workflow
node_config -->|"configures run"| node_workflow
node_workflow -->|"prepares inputs"| node_prep
node_workflow -->|"runs GeneMark"| node_genemark
node_workflow -->|"trains AUGUSTUS"| node_training
node_workflow -->|"runs prediction"| node_augustus
node_workflow -->|"merges predictions"| node_tsebra
node_workflow -.->|"may select RNA-Seq"| node_varus
node_workflow -.->|"optionally predicts"| node_ncrna
node_workflow -.->|"adds UTRs"| node_utr
node_workflow -->|"converts annotation"| node_gff
node_workflow -.->|"may rescue genes"| node_best
node_tsebra -->|"produces gene set"| node_output
node_gff -->|"exports annotation"| node_output
node_workflow -.->|"can export"| node_ena
node_workflow -.->|"optionally annotates proteins"| node_embeddings
node_embeddings -.->|"summarizes GO results"| node_fantasia
node_workflow -.->|"assesses evidence support"| node_hint
node_workflow -.->|"summarizes gene support"| node_support
node_workflow -.->|"reports gene statistics"| node_stats
node_workflow -.->|"generates run report"| node_report
node_workflow -.->|"summarizes training"| node_training_summary
node_workflow -.->|"may rescue agreement"| node_rescue
node_workflow -.->|"normalizes models"| node_normalize
node_workflow -.->|"repairs models"| node_stopfix
node_workflow -.->|"dispatches alignments"| node_spaln
node_workflow -.->|"extracts proteins"| node_protein_fasta
node_ncrna -.->|"merges predictions"| node_ncrna_merge

click node_inputs "https://github.com/gaius-augustus/braker4/blob/main/samples.csv"
click node_config "https://github.com/gaius-augustus/braker4/blob/main/config.ini.example"
click node_prep "https://github.com/gaius-augustus/braker4/tree/main/rules/preprocessing"
click node_varus "https://github.com/gaius-augustus/braker4/blob/main/rules/preprocessing/run_varus.smk"
click node_workflow "https://github.com/gaius-augustus/braker4/blob/main/Snakefile"
click node_genemark "https://github.com/gaius-augustus/braker4/tree/main/rules/genemark"
click node_training "https://github.com/gaius-augustus/braker4/tree/main/rules/augustus_training"
click node_augustus "https://github.com/gaius-augustus/braker4/tree/main/rules/augustus_predict"
click node_tsebra "https://github.com/gaius-augustus/braker4/blob/main/rules/postprocessing/run_tsebra.smk"
click node_best "https://github.com/gaius-augustus/braker4/blob/main/scripts/best_by_compleasm.py"
click node_rescue "https://github.com/gaius-augustus/braker4/blob/main/scripts/both_agree_rescue.py"
click node_normalize "https://github.com/gaius-augustus/braker4/blob/main/scripts/normalize_gtf.py"
click node_stopfix "https://github.com/gaius-augustus/braker4/blob/main/scripts/fix_in_frame_stop_codon_genes.py"
click node_utr "https://github.com/gaius-augustus/braker4/blob/main/scripts/stringtie2utr.py"
click node_gff "https://github.com/gaius-augustus/braker4/blob/main/rules/postprocessing/convert_to_gff3.smk"
click node_ena "https://github.com/gaius-augustus/braker4/blob/main/scripts/gff3_to_ena.py"
click node_ncrna "https://github.com/gaius-augustus/braker4/tree/main/rules/ncrna"
click node_embeddings "https://github.com/gaius-augustus/braker4/blob/main/scripts/generate_embeddings.py"
click node_fantasia "https://github.com/gaius-augustus/braker4/blob/main/scripts/fantasia_summary.py"
click node_hint "https://github.com/gaius-augustus/braker4/blob/main/scripts/analyze_hint_support.py"
click node_support "https://github.com/gaius-augustus/braker4/blob/main/scripts/gene_support_summary.py"
click node_stats "https://github.com/gaius-augustus/braker4/blob/main/scripts/gene_set_statistics.py"
click node_report "https://github.com/gaius-augustus/braker4/blob/main/scripts/generate_report.py"
click node_training_summary "https://github.com/gaius-augustus/braker4/blob/main/scripts/training_summary.py"
click node_spaln "https://github.com/gaius-augustus/braker4/blob/main/scripts/spaln_dispatcher.py"
click node_protein_fasta "https://github.com/gaius-augustus/braker4/blob/main/scripts/getAnnoFastaFromJoingenes.py"
click node_ncrna_merge "https://github.com/gaius-augustus/braker4/blob/main/scripts/merge_ncrna_gff3.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_inputs,node_config,node_prep,node_varus,node_user toneBlue
class node_workflow,node_genemark,node_training,node_augustus,node_tsebra,node_spaln toneAmber
class node_best,node_rescue,node_normalize,node_stopfix,node_utr,node_gff,node_ena,node_protein_fasta,node_output toneMint
class node_hint,node_support,node_stats,node_report,node_training_summary toneRose
class node_ncrna,node_embeddings,node_fantasia,node_ncrna_merge toneIndigo
```

## Components

### Inputs and preprocessing

- [Sample inputs](https://github.com/gaius-augustus/braker4/blob/main/samples.csv): `samples.csv`
- [Run configuration](https://github.com/gaius-augustus/braker4/blob/main/config.ini.example): `config.ini.example`
- [Genome and evidence prep](https://github.com/gaius-augustus/braker4/tree/main/rules/preprocessing): `rules/preprocessing`
- [RNA-Seq selection](https://github.com/gaius-augustus/braker4/blob/main/rules/preprocessing/run_varus.smk): `rules/preprocessing/run_varus.smk`

### Gene prediction

- [Snakemake workflow](https://github.com/gaius-augustus/braker4/blob/main/Snakefile): `Snakefile`
- [GeneMark evidence training](https://github.com/gaius-augustus/braker4/tree/main/rules/genemark): `rules/genemark`
- [AUGUSTUS training](https://github.com/gaius-augustus/braker4/tree/main/rules/augustus_training): `rules/augustus_training`
- [AUGUSTUS prediction](https://github.com/gaius-augustus/braker4/tree/main/rules/augustus_predict): `rules/augustus_predict`
- [TSEBRA merging](https://github.com/gaius-augustus/braker4/blob/main/rules/postprocessing/run_tsebra.smk): `rules/postprocessing/run_tsebra.smk`
- [Spaln dispatcher](https://github.com/gaius-augustus/braker4/blob/main/scripts/spaln_dispatcher.py): `scripts/spaln_dispatcher.py`

### Postprocessing and outputs

- [BUSCO gene rescue](https://github.com/gaius-augustus/braker4/blob/main/scripts/best_by_compleasm.py): `scripts/best_by_compleasm.py`
- [Agreement rescue](https://github.com/gaius-augustus/braker4/blob/main/scripts/both_agree_rescue.py): `scripts/both_agree_rescue.py`
- [Gene model normalization](https://github.com/gaius-augustus/braker4/blob/main/scripts/normalize_gtf.py): `scripts/normalize_gtf.py`
- [Stop-codon repair](https://github.com/gaius-augustus/braker4/blob/main/scripts/fix_in_frame_stop_codon_genes.py): `scripts/fix_in_frame_stop_codon_genes.py`
- [UTR decoration](https://github.com/gaius-augustus/braker4/blob/main/scripts/stringtie2utr.py): `scripts/stringtie2utr.py`
- [GFF3 conversion](https://github.com/gaius-augustus/braker4/blob/main/rules/postprocessing/convert_to_gff3.smk): `rules/postprocessing/convert_to_gff3.smk`
- [ENA export](https://github.com/gaius-augustus/braker4/blob/main/scripts/gff3_to_ena.py): `scripts/gff3_to_ena.py`
- [Protein extraction](https://github.com/gaius-augustus/braker4/blob/main/scripts/getAnnoFastaFromJoingenes.py): `scripts/getAnnoFastaFromJoingenes.py`
- **Annotation results**

### Quality and reporting

- [Hint support analysis](https://github.com/gaius-augustus/braker4/blob/main/scripts/analyze_hint_support.py): `scripts/analyze_hint_support.py`
- [Gene support summary](https://github.com/gaius-augustus/braker4/blob/main/scripts/gene_support_summary.py): `scripts/gene_support_summary.py`
- [Gene set statistics](https://github.com/gaius-augustus/braker4/blob/main/scripts/gene_set_statistics.py): `scripts/gene_set_statistics.py`
- [Run report](https://github.com/gaius-augustus/braker4/blob/main/scripts/generate_report.py): `scripts/generate_report.py`
- [Training summary](https://github.com/gaius-augustus/braker4/blob/main/scripts/training_summary.py): `scripts/training_summary.py`

### Optional annotation

- [Noncoding RNA](https://github.com/gaius-augustus/braker4/tree/main/rules/ncrna): `rules/ncrna`
- [Protein embeddings](https://github.com/gaius-augustus/braker4/blob/main/scripts/generate_embeddings.py): `scripts/generate_embeddings.py`
- [FANTASIA summaries](https://github.com/gaius-augustus/braker4/blob/main/scripts/fantasia_summary.py): `scripts/fantasia_summary.py`
- [ncRNA result merge](https://github.com/gaius-augustus/braker4/blob/main/scripts/merge_ncrna_gff3.py): `scripts/merge_ncrna_gff3.py`

### Other components

- **Annotation user**

## Connections

- Annotation user → Sample inputs: provides samples (evidence: `README.md`)
- Annotation user → Run configuration: sets options (evidence: `README.md`)
- Sample inputs → Snakemake workflow: configures run (evidence: `README.md`)
- Run configuration → Snakemake workflow: configures run (evidence: `README.md`)
- Snakemake workflow → Genome and evidence prep: prepares inputs (evidence: `README.md`)
- Snakemake workflow → GeneMark evidence training: runs GeneMark (evidence: `README.md`)
- Snakemake workflow → AUGUSTUS training: trains AUGUSTUS (evidence: `README.md`)
- Snakemake workflow → AUGUSTUS prediction: runs prediction (evidence: `README.md`)
- Snakemake workflow → TSEBRA merging: merges predictions (evidence: `README.md`)
- Snakemake workflow → RNA-Seq selection: may select RNA-Seq (evidence: `README.md`)
- Snakemake workflow → Noncoding RNA: optionally predicts (evidence: `README.md`)
- Snakemake workflow → UTR decoration: adds UTRs (evidence: `README.md`)
- Snakemake workflow → GFF3 conversion: converts annotation (evidence: `README.md`)
- Snakemake workflow → BUSCO gene rescue: may rescue genes (evidence: `README.md`)
- TSEBRA merging → Annotation results: produces gene set (evidence: `README.md`)
- GFF3 conversion → Annotation results: exports annotation (evidence: `README.md`)
- Snakemake workflow → ENA export: can export (evidence: `README.md`)
- Snakemake workflow → Protein embeddings: optionally annotates proteins (evidence: `README.md`)
- Protein embeddings → FANTASIA summaries: summarizes GO results (evidence: `scripts/fantasia_summary.py`)
- Snakemake workflow → Hint support analysis: assesses evidence support (evidence: `scripts/analyze_hint_support.py`)
- Snakemake workflow → Gene support summary: summarizes gene support (evidence: `README.md`)
- Snakemake workflow → Gene set statistics: reports gene statistics (evidence: `scripts/gene_set_statistics.py`)
- Snakemake workflow → Run report: generates run report (evidence: `scripts/generate_report.py`)
- Snakemake workflow → Training summary: summarizes training (evidence: `scripts/training_summary.py`)
- Snakemake workflow → Agreement rescue: may rescue agreement (evidence: `scripts/both_agree_rescue.py`)
- Snakemake workflow → Gene model normalization: normalizes models (evidence: `scripts/normalize_gtf.py`)
- Snakemake workflow → Stop-codon repair: repairs models (evidence: `scripts/fix_in_frame_stop_codon_genes.py`)
- Snakemake workflow → Spaln dispatcher: dispatches alignments (evidence: `scripts/spaln_dispatcher.py`)
- Snakemake workflow → Protein extraction: extracts proteins (evidence: `README.md`)
- Noncoding RNA → ncRNA result merge: merges predictions (evidence: `README.md`)
