# joanmarticarreras/bktyper architecture

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

- Interactive diagram: https://gitdiagram.com/joanmarticarreras/bktyper
- Repository: https://github.com/joanmarticarreras/bktyper

## Overview

BKTyper is a command-line BKPyV typing tool. Its principal workflow accepts FASTA input and a mode (VP1, NCCR, or complete), then classifies VP1 and/or NCCR regions and writes tabular, FASTA, and visual results. Optional tree analysis is available for VP1 and complete modes. The implementation is concentrated in one script, so its domain stages share that source path. The tree and README document bundled reference data and capabilities; unsampled implementation details are not inferred.

Main entry points: [`BKTyper.py`](https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py) (CLI workflow), [`source/NCCR_BKTyper.fasta`](https://github.com/joanmarticarreras/bktyper/blob/master/source/NCCR_BKTyper.fasta) (NCCR reference), [`source/VP1_Dunlop.fasta`](https://github.com/joanmarticarreras/bktyper/blob/master/source/VP1_Dunlop.fasta) (VP1 references), [`source/VP1_BKTyper_MLtree_list.fasta`](https://github.com/joanmarticarreras/bktyper/blob/master/source/VP1_BKTyper_MLtree_list.fasta) (Tree sequences)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Sequence analysis"]
  node_cli["CLI workflow<br/>[BKTyper.py]"]
  node_nccrblast["NCCR search<br/>[BKTyper.py]"]
  node_vp1align["VP1 alignment<br/>[BKTyper.py]"]
end

subgraph group_typing["Typing and phylogeny"]
  node_nccrtype["NCCR typing<br/>[BKTyper.py]"]
  node_motifs["Motif mapping<br/>[BKTyper.py]"]
  node_vp1type["VP1 typing<br/>[BKTyper.py]"]
  node_tree["VP1 tree<br/>[BKTyper.py]"]
end

subgraph group_resources["Reference data"]
  node_nccrref["NCCR reference<br/>[NCCR_BKTyper.fasta]"]
  node_vp1ref["VP1 references<br/>[VP1_Dunlop.fasta]"]
  node_vp1treefasta["Tree sequences"]
  node_vp1treelist["Subtype labels"]
  node_motifref["Motif definitions<br/>[motif_list.txt]"]
end

subgraph group_results["Results"]
  node_visual["NCCR visuals<br/>[BKTyper.py]"]
  node_outputs["Result files<br/>[BKTyper.py]"]
end

node_user(("Analyst"))
node_blast["BLAST"]
node_emboss["EMBOSS"]
node_mafft["MAFFT"]
node_iqtree["IQ-TREE"]

node_user -->|"submits FASTA"| node_cli
node_cli -->|"searches NCCR"| node_nccrblast
node_nccrblast -->|"runs search"| node_blast
node_nccrblast -->|"searches against"| node_nccrref
node_cli -->|"aligns VP1"| node_vp1align
node_vp1align -->|"runs alignment"| node_emboss
node_vp1align -->|"aligns against"| node_vp1ref
node_cli -->|"classifies blocks"| node_nccrtype
node_nccrblast -->|"provides hits"| node_nccrtype
node_cli -->|"maps motifs"| node_motifs
node_motifs -->|"reads definitions"| node_motifref
node_cli -->|"classifies VP1"| node_vp1type
node_vp1align -->|"provides alignment"| node_vp1type
node_cli -.->|"optionally builds"| node_tree
node_tree -->|"aligns sequences"| node_mafft
node_tree -->|"reads sequences"| node_vp1treefasta
node_tree -->|"reads subtype labels"| node_vp1treelist
node_tree -.->|"builds phylogeny"| node_iqtree
node_cli -->|"renders NCCR"| node_visual
node_motifs -->|"supplies regions"| node_visual
node_cli -->|"writes results"| node_outputs

click node_cli "https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py"
click node_nccrblast "https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py"
click node_vp1align "https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py"
click node_nccrtype "https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py"
click node_motifs "https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py"
click node_vp1type "https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py"
click node_tree "https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py"
click node_visual "https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py"
click node_outputs "https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py"
click node_nccrref "https://github.com/joanmarticarreras/bktyper/blob/master/source/NCCR_BKTyper.fasta"
click node_vp1ref "https://github.com/joanmarticarreras/bktyper/blob/master/source/VP1_Dunlop.fasta"
click node_vp1treefasta "https://github.com/joanmarticarreras/bktyper/blob/master/source/VP1_BKTyper_MLtree_list.fasta"
click node_vp1treelist "https://github.com/joanmarticarreras/bktyper/blob/master/source/VP1_BKTyper_MLtree_list.txt"
click node_motifref "https://github.com/joanmarticarreras/bktyper/blob/master/source/motif_list.txt"

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_nccrblast,node_vp1align toneBlue
class node_nccrtype,node_motifs,node_vp1type,node_tree toneAmber
class node_nccrref,node_vp1ref,node_vp1treefasta,node_vp1treelist,node_motifref toneMint
class node_visual,node_outputs toneRose
class node_user,node_blast,node_emboss,node_mafft,node_iqtree toneIndigo
```

## Components

### Sequence analysis

- [CLI workflow](https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py): `BKTyper.py`
- [NCCR search](https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py): `BKTyper.py`
- [VP1 alignment](https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py): `BKTyper.py`

### Typing and phylogeny

- [NCCR typing](https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py): `BKTyper.py`
- [Motif mapping](https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py): `BKTyper.py`
- [VP1 typing](https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py): `BKTyper.py`
- [VP1 tree](https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py): `BKTyper.py`

### Reference data

- [NCCR reference](https://github.com/joanmarticarreras/bktyper/blob/master/source/NCCR_BKTyper.fasta): `source/NCCR_BKTyper.fasta`
- [VP1 references](https://github.com/joanmarticarreras/bktyper/blob/master/source/VP1_Dunlop.fasta): `source/VP1_Dunlop.fasta`
- [Tree sequences](https://github.com/joanmarticarreras/bktyper/blob/master/source/VP1_BKTyper_MLtree_list.fasta): `source/VP1_BKTyper_MLtree_list.fasta`
- [Subtype labels](https://github.com/joanmarticarreras/bktyper/blob/master/source/VP1_BKTyper_MLtree_list.txt): `source/VP1_BKTyper_MLtree_list.txt`
- [Motif definitions](https://github.com/joanmarticarreras/bktyper/blob/master/source/motif_list.txt): `source/motif_list.txt`

### Results

- [NCCR visuals](https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py): `BKTyper.py`
- [Result files](https://github.com/joanmarticarreras/bktyper/blob/master/BKTyper.py): `BKTyper.py`

### Other components

- **Analyst**
- **BLAST**
- **EMBOSS**
- **MAFFT**
- **IQ-TREE**

## Connections

- Analyst → CLI workflow: submits FASTA (evidence: `README.md`)
- CLI workflow → NCCR search: searches NCCR (evidence: `BKTyper.py`)
- NCCR search → BLAST: runs search (evidence: `BKTyper.py`)
- NCCR search → NCCR reference: searches against (evidence: `BKTyper.py`)
- CLI workflow → VP1 alignment: aligns VP1 (evidence: `BKTyper.py`)
- VP1 alignment → EMBOSS: runs alignment (evidence: `BKTyper.py`)
- VP1 alignment → VP1 references: aligns against (evidence: `BKTyper.py`)
- CLI workflow → NCCR typing: classifies blocks (evidence: `BKTyper.py`)
- NCCR search → NCCR typing: provides hits (evidence: `BKTyper.py`)
- CLI workflow → Motif mapping: maps motifs (evidence: `BKTyper.py`)
- Motif mapping → Motif definitions: reads definitions (evidence: `BKTyper.py`)
- CLI workflow → VP1 typing: classifies VP1 (evidence: `BKTyper.py`)
- VP1 alignment → VP1 typing: provides alignment (evidence: `BKTyper.py`)
- CLI workflow → VP1 tree: optionally builds (evidence: `README.md`)
- VP1 tree → MAFFT: aligns sequences (evidence: `BKTyper.py`)
- VP1 tree → Tree sequences: reads sequences (evidence: `BKTyper.py`)
- VP1 tree → Subtype labels: reads subtype labels (evidence: `BKTyper.py`)
- VP1 tree → IQ-TREE: builds phylogeny (evidence: `README.md`)
- CLI workflow → NCCR visuals: renders NCCR (evidence: `BKTyper.py`)
- Motif mapping → NCCR visuals: supplies regions (evidence: `BKTyper.py`)
- CLI workflow → Result files: writes results (evidence: `BKTyper.py`)
