# ericbretz/transrate2 architecture

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

- Interactive diagram: https://gitdiagram.com/ericbretz/transrate2
- Repository: https://github.com/ericbretz/transrate2

## Overview

TransRate2 evaluates de-novo transcriptome assemblies from FASTA and sequencing reads, producing assembly- and contig-level quality metrics. The main workflow parses user options, orchestrates read alignment and BAM preparation, then coordinates contig and assembly analyses and gathers results. The README also highlights reference-based evaluation and multiple aligners. Edges reflect visible orchestration or SOURCE INDEX references; several implementation details and the exact final report-writing flow are not shown in the excerpts.

Main entry points: [`core/datahub.py`](https://github.com/ericbretz/transrate2/blob/main/core/datahub.py) (Analysis coordinator), [`core/contighub.py`](https://github.com/ericbretz/transrate2/blob/main/core/contighub.py) (Contig coordinator), [`core/assemblyhub.py`](https://github.com/ericbretz/transrate2/blob/main/core/assemblyhub.py) (Assembly coordinator), [`core/contig/combined.py`](https://github.com/ericbretz/transrate2/blob/main/core/contig/combined.py) (Alignment metrics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Workflow orchestration"]
  node_cli["CLI entry<br/>[transrate2.py]"]
  node_datahub["Analysis coordinator<br/>[datahub.py]"]
end

subgraph group_mapping["Read mapping"]
  node_aligner["Aligner selection<br/>[datahub.py]"]
  node_bowtie["Bowtie2<br/>[bowtie2.py]"]
  node_hisat["HISAT2<br/>[hisat2.py]"]
  node_salmon["Salmon quantification<br/>[salmon.py]"]
  node_alignbase["Aligner command runner<br/>[runner.py]"]
  node_samtools["BAM preparation<br/>[samtools.py]"]
end

subgraph group_contigs["Contig analysis"]
  node_contighub["Contig coordinator<br/>[contighub.py]"]
  node_combined["Alignment metrics<br/>[combined.py]"]
  node_seqmetrics["CIGAR accuracy<br/>[seqs.py]"]
  node_segmentation["Coverage segmentation<br/>[sgmt.py]"]
  node_contighelpers["Contig helpers"]
end

subgraph group_assembly["Assembly assessment"]
  node_assemblyhub["Assembly coordinator<br/>[assemblyhub.py]"]
  node_assemblymetrics["FASTA and N metrics"]
  node_score["Assembly scoring<br/>[scoreCalc.py]"]
  node_reference["Reference evaluation<br/>[reference.py]"]
end

subgraph group_support["Results and interface"]
  node_csv["CSV processing<br/>[csvProcess.py]"]
  node_output["Console reporting<br/>[printout.py]"]
  node_logging["Run logging<br/>[logging.py]"]
  node_merge["DataFrame merging<br/>[dfmerge.py]"]
end

node_user(("Analyst"))

node_user -->|"provides options"| node_cli
node_cli -->|"starts analysis"| node_datahub
node_datahub -->|"selects aligner"| node_aligner
node_aligner -->|"dispatches to"| node_bowtie
node_aligner -->|"dispatches to"| node_hisat
node_aligner -->|"dispatches to"| node_salmon
node_bowtie -->|"uses runner"| node_alignbase
node_hisat -->|"uses runner"| node_alignbase
node_salmon -->|"uses runner"| node_alignbase
node_datahub -->|"prepares BAM"| node_samtools
node_datahub -->|"runs contig analysis"| node_contighub
node_contighub -->|"runs metrics"| node_combined
node_combined -->|"calculates accuracy"| node_seqmetrics
node_combined -->|"estimates segmentation"| node_segmentation
node_contighub -->|"uses helpers"| node_contighelpers
node_datahub -->|"runs assembly analysis"| node_assemblyhub
node_assemblyhub -->|"runs metric stages"| node_assemblymetrics
node_assemblyhub -->|"runs scoring"| node_score
node_datahub -->|"uses reference evaluation"| node_reference
node_datahub -->|"uses CSV processing"| node_csv
node_datahub -->|"reports progress"| node_output
node_datahub -->|"logs subprocesses"| node_logging
node_assemblyhub -->|"merges metrics"| node_merge
node_contighub -->|"merges results"| node_merge

click node_cli "https://github.com/ericbretz/transrate2/blob/main/transrate2.py"
click node_datahub "https://github.com/ericbretz/transrate2/blob/main/core/datahub.py"
click node_aligner "https://github.com/ericbretz/transrate2/blob/main/core/datahub.py"
click node_bowtie "https://github.com/ericbretz/transrate2/blob/main/core/alignments/bowtie2.py"
click node_hisat "https://github.com/ericbretz/transrate2/blob/main/core/alignments/hisat2.py"
click node_salmon "https://github.com/ericbretz/transrate2/blob/main/core/alignments/salmon.py"
click node_alignbase "https://github.com/ericbretz/transrate2/blob/main/core/alignments/runner.py"
click node_samtools "https://github.com/ericbretz/transrate2/blob/main/core/alignments/samtools.py"
click node_contighub "https://github.com/ericbretz/transrate2/blob/main/core/contighub.py"
click node_combined "https://github.com/ericbretz/transrate2/blob/main/core/contig/combined.py"
click node_seqmetrics "https://github.com/ericbretz/transrate2/blob/main/core/contig/seqs.py"
click node_segmentation "https://github.com/ericbretz/transrate2/blob/main/core/contig/sgmt.py"
click node_contighelpers "https://github.com/ericbretz/transrate2/tree/main/core/contig"
click node_assemblyhub "https://github.com/ericbretz/transrate2/blob/main/core/assemblyhub.py"
click node_assemblymetrics "https://github.com/ericbretz/transrate2/tree/main/core/assembly"
click node_score "https://github.com/ericbretz/transrate2/blob/main/core/assembly/scoreCalc.py"
click node_reference "https://github.com/ericbretz/transrate2/blob/main/core/assembly/reference.py"
click node_csv "https://github.com/ericbretz/transrate2/blob/main/core/csvProcess.py"
click node_output "https://github.com/ericbretz/transrate2/blob/main/core/utils/printout.py"
click node_logging "https://github.com/ericbretz/transrate2/blob/main/core/utils/logging.py"
click node_merge "https://github.com/ericbretz/transrate2/blob/main/core/utils/dfmerge.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_datahub toneBlue
class node_aligner,node_bowtie,node_hisat,node_salmon,node_alignbase,node_samtools toneAmber
class node_contighub,node_combined,node_seqmetrics,node_segmentation,node_contighelpers toneMint
class node_assemblyhub,node_assemblymetrics,node_score,node_reference toneRose
class node_csv,node_output,node_logging,node_merge,node_user toneIndigo
```

## Components

### Workflow orchestration

- [CLI entry](https://github.com/ericbretz/transrate2/blob/main/transrate2.py): `transrate2.py`
- [Analysis coordinator](https://github.com/ericbretz/transrate2/blob/main/core/datahub.py): `core/datahub.py`

### Read mapping

- [Aligner selection](https://github.com/ericbretz/transrate2/blob/main/core/datahub.py): `core/datahub.py`
- [Bowtie2](https://github.com/ericbretz/transrate2/blob/main/core/alignments/bowtie2.py): `core/alignments/bowtie2.py`
- [HISAT2](https://github.com/ericbretz/transrate2/blob/main/core/alignments/hisat2.py): `core/alignments/hisat2.py`
- [Salmon quantification](https://github.com/ericbretz/transrate2/blob/main/core/alignments/salmon.py): `core/alignments/salmon.py`
- [Aligner command runner](https://github.com/ericbretz/transrate2/blob/main/core/alignments/runner.py): `core/alignments/runner.py`
- [BAM preparation](https://github.com/ericbretz/transrate2/blob/main/core/alignments/samtools.py): `core/alignments/samtools.py`

### Contig analysis

- [Contig coordinator](https://github.com/ericbretz/transrate2/blob/main/core/contighub.py): `core/contighub.py`
- [Alignment metrics](https://github.com/ericbretz/transrate2/blob/main/core/contig/combined.py): `core/contig/combined.py`
- [CIGAR accuracy](https://github.com/ericbretz/transrate2/blob/main/core/contig/seqs.py): `core/contig/seqs.py`
- [Coverage segmentation](https://github.com/ericbretz/transrate2/blob/main/core/contig/sgmt.py): `core/contig/sgmt.py`
- [Contig helpers](https://github.com/ericbretz/transrate2/tree/main/core/contig): `core/contig`

### Assembly assessment

- [Assembly coordinator](https://github.com/ericbretz/transrate2/blob/main/core/assemblyhub.py): `core/assemblyhub.py`
- [FASTA and N metrics](https://github.com/ericbretz/transrate2/tree/main/core/assembly): `core/assembly`
- [Assembly scoring](https://github.com/ericbretz/transrate2/blob/main/core/assembly/scoreCalc.py): `core/assembly/scoreCalc.py`
- [Reference evaluation](https://github.com/ericbretz/transrate2/blob/main/core/assembly/reference.py): `core/assembly/reference.py`

### Results and interface

- [CSV processing](https://github.com/ericbretz/transrate2/blob/main/core/csvProcess.py): `core/csvProcess.py`
- [Console reporting](https://github.com/ericbretz/transrate2/blob/main/core/utils/printout.py): `core/utils/printout.py`
- [Run logging](https://github.com/ericbretz/transrate2/blob/main/core/utils/logging.py): `core/utils/logging.py`
- [DataFrame merging](https://github.com/ericbretz/transrate2/blob/main/core/utils/dfmerge.py): `core/utils/dfmerge.py`

### Other components

- **Analyst**

## Connections

- Analyst → CLI entry: provides options (evidence: `transrate2.py`)
- CLI entry → Analysis coordinator: starts analysis (evidence: `transrate2.py`)
- Analysis coordinator → Aligner selection: selects aligner (evidence: `core/datahub.py`)
- Aligner selection → Bowtie2: dispatches to (evidence: `core/datahub.py`)
- Aligner selection → HISAT2: dispatches to (evidence: `core/datahub.py`)
- Aligner selection → Salmon quantification: dispatches to (evidence: `core/datahub.py`)
- Bowtie2 → Aligner command runner: uses runner (evidence: `core/alignments/bowtie2.py`)
- HISAT2 → Aligner command runner: uses runner (evidence: `core/alignments/hisat2.py`)
- Salmon quantification → Aligner command runner: uses runner (evidence: `core/alignments/salmon.py`)
- Analysis coordinator → BAM preparation: prepares BAM (evidence: `core/datahub.py`)
- Analysis coordinator → Contig coordinator: runs contig analysis (evidence: `core/datahub.py`)
- Contig coordinator → Alignment metrics: runs metrics (evidence: `core/contighub.py`)
- Alignment metrics → CIGAR accuracy: calculates accuracy (evidence: `core/contig/combined.py`)
- Alignment metrics → Coverage segmentation: estimates segmentation (evidence: `core/contig/combined.py`)
- Contig coordinator → Contig helpers: uses helpers (evidence: `core/contighub.py`)
- Analysis coordinator → Assembly coordinator: runs assembly analysis (evidence: `core/datahub.py`)
- Assembly coordinator → FASTA and N metrics: runs metric stages (evidence: `core/assemblyhub.py`)
- Assembly coordinator → Assembly scoring: runs scoring (evidence: `core/assemblyhub.py`)
- Analysis coordinator → Reference evaluation: uses reference evaluation (evidence: `core/datahub.py`)
- Analysis coordinator → CSV processing: uses CSV processing (evidence: `core/datahub.py`)
- Analysis coordinator → Console reporting: reports progress (evidence: `core/datahub.py`)
- Analysis coordinator → Run logging: logs subprocesses (evidence: `core/datahub.py`)
- Assembly coordinator → DataFrame merging: merges metrics (evidence: `core/assemblyhub.py`)
- Contig coordinator → DataFrame merging: merges results (evidence: `core/contighub.py`)
