# genomicsiter/nanoclust architecture

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

- Interactive diagram: https://gitdiagram.com/genomicsiter/nanoclust
- Repository: https://github.com/genomicsiter/nanoclust

## Overview

NanoCLUST is a Nextflow pipeline for clustering ONT 16S reads and building consensus sequences, with cluster classification and abundance summaries as downstream analysis capabilities. The documented entry point is `main.nf`; the sampled Python templates show k-mer feature generation, UMAP/HDBSCAN clustering, abundance aggregation, and plotting. The README and excerpts do not expose the Nextflow process wiring or consensus implementation, so those stage links are shown as unverified rather than asserted as source-confirmed calls.

Main entry points: [`main.nf`](https://github.com/genomicsiter/nanoclust/blob/master/main.nf) (Nextflow workflow), [`templates/get_abundance.py`](https://github.com/genomicsiter/nanoclust/blob/master/templates/get_abundance.py) (Abundance summaries), [`conda_envs/consensus_classification`](https://github.com/genomicsiter/nanoclust/tree/master/conda_envs/consensus_classification) (Cluster classification), [`templates/kmer_freq.py`](https://github.com/genomicsiter/nanoclust/blob/master/templates/kmer_freq.py) (K-mer features)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Pipeline workflow"]
  node_workflow["Nextflow workflow<br/>[main.nf]"]
  node_qc["Read preparation<br/>[main.nf]"]
end

subgraph group_cluster["Read clustering"]
  node_features["K-mer features<br/>[kmer_freq.py]"]
  node_kmer_cli["K-mer utility<br/>[kmer_freq.py]"]
  node_clusterer["UMAP HDBSCAN<br/>[umap_hdbscan.py]"]
  node_cluster_plot["Cluster plot<br/>[umap_plot.py]"]
  node_split["Cluster splitting"]
end

subgraph group_classify["Consensus and classification"]
  node_consensus["Consensus building"]
  node_ranking["Draft ranking<br/>[fastani_ranking.py]"]
  node_classification["Cluster classification"]
end

subgraph group_abundance["Abundance analysis"]
  node_abundance["Abundance summaries<br/>[get_abundance.py]"]
  node_abundance_plot["Abundance plots"]
end

node_user(("Analyst"))
node_reads["ONT reads"]
node_blastdb[("BLAST database")]
node_unipept["UniPept taxonomy API"]
node_results["Analysis outputs"]

node_user -->|"runs"| node_workflow
node_reads -->|"supplies reads"| node_workflow
node_workflow -.->|"dispatches"| node_qc
node_qc -.->|"prepares reads"| node_features
node_features -.->|"provides features"| node_clusterer
node_kmer_cli -->|"prints vectors"| node_results
node_clusterer -->|"writes clustering table"| node_cluster_plot
node_workflow -.->|"dispatches"| node_split
node_split -.->|"supplies clusters"| node_consensus
node_consensus -.->|"selects draft"| node_ranking
node_ranking -.->|"selects representative"| node_classification
node_blastdb -->|"supports taxonomy lookup"| node_classification
node_classification -.->|"provides cluster tables"| node_abundance
node_unipept -->|"resolves taxon names"| node_abundance
node_abundance -->|"reads summary table"| node_abundance_plot
node_abundance -->|"writes summaries"| node_results
node_abundance_plot -->|"writes plot"| node_results
node_cluster_plot -->|"writes plot"| node_results

click node_workflow "https://github.com/genomicsiter/nanoclust/blob/master/main.nf"
click node_qc "https://github.com/genomicsiter/nanoclust/blob/master/main.nf"
click node_features "https://github.com/genomicsiter/nanoclust/blob/master/templates/kmer_freq.py"
click node_kmer_cli "https://github.com/genomicsiter/nanoclust/blob/master/bin/kmer_freq.py"
click node_clusterer "https://github.com/genomicsiter/nanoclust/blob/master/templates/umap_hdbscan.py"
click node_cluster_plot "https://github.com/genomicsiter/nanoclust/blob/master/templates/umap_plot.py"
click node_split "https://github.com/genomicsiter/nanoclust/tree/master/conda_envs/split_by_cluster"
click node_consensus "https://github.com/genomicsiter/nanoclust/tree/master/conda_envs/consensus_classification"
click node_ranking "https://github.com/genomicsiter/nanoclust/blob/master/templates/fastani_ranking.py"
click node_classification "https://github.com/genomicsiter/nanoclust/tree/master/conda_envs/consensus_classification"
click node_abundance "https://github.com/genomicsiter/nanoclust/blob/master/templates/get_abundance.py"
click node_abundance_plot "https://github.com/genomicsiter/nanoclust/blob/master/templates/plot_abundances_pool.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_workflow,node_qc toneBlue
class node_features,node_kmer_cli,node_clusterer,node_cluster_plot,node_split,node_blastdb toneAmber
class node_consensus,node_ranking,node_classification,node_unipept toneMint
class node_abundance,node_abundance_plot toneRose
class node_user,node_reads,node_results toneIndigo
```

## Components

### Pipeline workflow

- [Nextflow workflow](https://github.com/genomicsiter/nanoclust/blob/master/main.nf): `main.nf`
- [Read preparation](https://github.com/genomicsiter/nanoclust/blob/master/main.nf): `main.nf`

### Read clustering

- [K-mer features](https://github.com/genomicsiter/nanoclust/blob/master/templates/kmer_freq.py): `templates/kmer_freq.py`
- [K-mer utility](https://github.com/genomicsiter/nanoclust/blob/master/bin/kmer_freq.py): `bin/kmer_freq.py`
- [UMAP HDBSCAN](https://github.com/genomicsiter/nanoclust/blob/master/templates/umap_hdbscan.py): `templates/umap_hdbscan.py`
- [Cluster plot](https://github.com/genomicsiter/nanoclust/blob/master/templates/umap_plot.py): `templates/umap_plot.py`
- [Cluster splitting](https://github.com/genomicsiter/nanoclust/tree/master/conda_envs/split_by_cluster): `conda_envs/split_by_cluster`

### Consensus and classification

- [Consensus building](https://github.com/genomicsiter/nanoclust/tree/master/conda_envs/consensus_classification): `conda_envs/consensus_classification`
- [Draft ranking](https://github.com/genomicsiter/nanoclust/blob/master/templates/fastani_ranking.py): `templates/fastani_ranking.py`
- [Cluster classification](https://github.com/genomicsiter/nanoclust/tree/master/conda_envs/consensus_classification): `conda_envs/consensus_classification`

### Abundance analysis

- [Abundance summaries](https://github.com/genomicsiter/nanoclust/blob/master/templates/get_abundance.py): `templates/get_abundance.py`
- [Abundance plots](https://github.com/genomicsiter/nanoclust/blob/master/templates/plot_abundances_pool.py): `templates/plot_abundances_pool.py`

### Other components

- **Analyst**
- **ONT reads**
- **BLAST database**
- **UniPept taxonomy API**
- **Analysis outputs**

## Connections

- Analyst → Nextflow workflow: runs (evidence: `README.md`)
- ONT reads → Nextflow workflow: supplies reads (evidence: `README.md`)
- Nextflow workflow → Read preparation: dispatches
- Read preparation → K-mer features: prepares reads
- K-mer features → UMAP HDBSCAN: provides features
- K-mer utility → Analysis outputs: prints vectors (evidence: `bin/kmer_freq.py`)
- UMAP HDBSCAN → Cluster plot: writes clustering table (evidence: `templates/umap_hdbscan.py`)
- Nextflow workflow → Cluster splitting: dispatches
- Cluster splitting → Consensus building: supplies clusters
- Consensus building → Draft ranking: selects draft
- Draft ranking → Cluster classification: selects representative
- BLAST database → Cluster classification: supports taxonomy lookup (evidence: `README.md`)
- Cluster classification → Abundance summaries: provides cluster tables
- UniPept taxonomy API → Abundance summaries: resolves taxon names (evidence: `templates/get_abundance.py`)
- Abundance summaries → Abundance plots: reads summary table (evidence: `templates/plot_abundances_pool.py`)
- Abundance summaries → Analysis outputs: writes summaries (evidence: `templates/get_abundance.py`)
- Abundance plots → Analysis outputs: writes plot (evidence: `templates/plot_abundances_pool.py`)
- Cluster plot → Analysis outputs: writes plot (evidence: `templates/umap_plot.py`)
