# soedinglab/mmseqs2 architecture

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

- Interactive diagram: https://gitdiagram.com/soedinglab/mmseqs2
- Repository: https://github.com/soedinglab/mmseqs2

## Overview

MMseqs2 is a command-line suite for searching and clustering large protein and nucleotide sequence databases, with related taxonomy and profile-search capabilities. Users can run easy workflows on FASTA/FASTQ inputs or compose lower-level database modules. The graph emphasizes search and clustering, then shows database management and taxonomy as distinct capabilities. The README documents the workflow capabilities; source-index references and excerpts support only some internal relationships, so unverified links are omitted or dashed rather than presented as inspected call paths.

Main entry points: [`src/workflow/Search.cpp`](https://github.com/soedinglab/mmseqs2/blob/master/src/workflow/Search.cpp) (Search Workflow), [`src/commons/Application.cpp`](https://github.com/soedinglab/mmseqs2/blob/master/src/commons/Application.cpp) (Command Entry), [`src/linclust/kmersearch.cpp`](https://github.com/soedinglab/mmseqs2/blob/master/src/linclust/kmersearch.cpp) (K-mer Search), [`src/prefiltering/QueryMatcher.cpp`](https://github.com/soedinglab/mmseqs2/blob/master/src/prefiltering/QueryMatcher.cpp) (K-mer Prefilter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Command Runtime"]
  node_cli["Command Entry<br/>[Application.cpp]"]
  node_registration["Command Registry<br/>[MMseqsBase.cpp]"]
  node_params["Parameter Model<br/>[Parameters.h]"]
end

subgraph group_search["Sequence Search"]
  node_easysearch["Easy Search<br/>[EasySearch.cpp]"]
  node_searchflow["Search Workflow<br/>[Search.cpp]"]
  node_prefilter["K-mer Prefilter<br/>[QueryMatcher.cpp]"]
  node_prefilterentry["Prefilter Command<br/>[Main.cpp]"]
  node_kmersearch["K-mer Search<br/>[kmersearch.cpp]"]
  node_alignment["Alignment<br/>[Main.cpp]"]
  node_multihit["Multi-hit Search<br/>[MultiHitSearch.cpp]"]
end

subgraph group_cluster["Clustering"]
  node_clusterworkflow["Cluster Workflow<br/>[Main.cpp]"]
  node_linsearchindex["Linsearch Index"]
end

subgraph group_data["Database and Taxonomy"]
  node_dbworkflow["Database Workflows<br/>[Databases.cpp]"]
  node_dbreader[("Database Reader<br/>[DBReader.h]")]
  node_taxonomy["Taxonomy Tools<br/>[NcbiTaxonomy.cpp]"]
  node_taxreport["Taxonomy Reports<br/>[taxonomyreport.cpp]"]
end

node_user(("CLI User"))
node_externaldb[("Sequence Databases")]
node_results["Search Results"]

node_user -->|"invokes"| node_cli
node_cli -.->|"dispatches"| node_registration
node_cli -.->|"parses options"| node_params
node_user -->|"selects workflow"| node_easysearch
node_easysearch -.->|"runs search"| node_searchflow
node_searchflow -->|"reads databases"| node_dbreader
node_searchflow -.->|"runs prefilter"| node_prefilterentry
node_prefilterentry -.->|"uses matcher"| node_prefilter
node_prefilter -.->|"emits hits"| node_results
node_user -->|"selects clustering"| node_clusterworkflow
node_clusterworkflow -.->|"supports linclust"| node_kmersearch
node_kmersearch -->|"uses matcher"| node_prefilter
node_kmersearch -->|"reads index"| node_linsearchindex
node_user -.->|"manages databases"| node_dbworkflow
node_dbworkflow -.->|"downloads datasets"| node_externaldb
node_user -->|"assigns taxonomy"| node_taxonomy
node_taxonomy -.->|"supports reporting"| node_taxreport
node_searchflow -.->|"aligns candidates"| node_alignment
node_searchflow -.->|"supports multi-hit"| node_multihit

click node_cli "https://github.com/soedinglab/mmseqs2/blob/master/src/commons/Application.cpp"
click node_registration "https://github.com/soedinglab/mmseqs2/blob/master/src/MMseqsBase.cpp"
click node_params "https://github.com/soedinglab/mmseqs2/blob/master/src/commons/Parameters.h"
click node_easysearch "https://github.com/soedinglab/mmseqs2/blob/master/src/workflow/EasySearch.cpp"
click node_searchflow "https://github.com/soedinglab/mmseqs2/blob/master/src/workflow/Search.cpp"
click node_prefilter "https://github.com/soedinglab/mmseqs2/blob/master/src/prefiltering/QueryMatcher.cpp"
click node_prefilterentry "https://github.com/soedinglab/mmseqs2/blob/master/src/prefiltering/Main.cpp"
click node_kmersearch "https://github.com/soedinglab/mmseqs2/blob/master/src/linclust/kmersearch.cpp"
click node_alignment "https://github.com/soedinglab/mmseqs2/blob/master/src/alignment/Main.cpp"
click node_clusterworkflow "https://github.com/soedinglab/mmseqs2/blob/master/src/clustering/Main.cpp"
click node_linsearchindex "https://github.com/soedinglab/mmseqs2/blob/master/src/linclust/LinsearchIndexReader.cpp"
click node_dbworkflow "https://github.com/soedinglab/mmseqs2/blob/master/src/workflow/Databases.cpp"
click node_dbreader "https://github.com/soedinglab/mmseqs2/blob/master/src/commons/DBReader.h"
click node_taxonomy "https://github.com/soedinglab/mmseqs2/blob/master/src/taxonomy/NcbiTaxonomy.cpp"
click node_taxreport "https://github.com/soedinglab/mmseqs2/blob/master/src/taxonomy/taxonomyreport.cpp"
click node_multihit "https://github.com/soedinglab/mmseqs2/blob/master/src/multihit/MultiHitSearch.cpp"

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_registration,node_params,node_user toneBlue
class node_easysearch,node_searchflow,node_prefilter,node_prefilterentry,node_kmersearch,node_alignment,node_multihit,node_externaldb toneAmber
class node_clusterworkflow,node_linsearchindex toneMint
class node_dbworkflow,node_dbreader,node_taxonomy,node_taxreport toneRose
class node_results toneIndigo
```

## Components

### Command Runtime

- [Command Entry](https://github.com/soedinglab/mmseqs2/blob/master/src/commons/Application.cpp): `src/commons/Application.cpp`
- [Command Registry](https://github.com/soedinglab/mmseqs2/blob/master/src/MMseqsBase.cpp): `src/MMseqsBase.cpp`
- [Parameter Model](https://github.com/soedinglab/mmseqs2/blob/master/src/commons/Parameters.h): `src/commons/Parameters.h`

### Sequence Search

- [Easy Search](https://github.com/soedinglab/mmseqs2/blob/master/src/workflow/EasySearch.cpp): `src/workflow/EasySearch.cpp`
- [Search Workflow](https://github.com/soedinglab/mmseqs2/blob/master/src/workflow/Search.cpp): `src/workflow/Search.cpp`
- [K-mer Prefilter](https://github.com/soedinglab/mmseqs2/blob/master/src/prefiltering/QueryMatcher.cpp): `src/prefiltering/QueryMatcher.cpp`
- [Prefilter Command](https://github.com/soedinglab/mmseqs2/blob/master/src/prefiltering/Main.cpp): `src/prefiltering/Main.cpp`
- [K-mer Search](https://github.com/soedinglab/mmseqs2/blob/master/src/linclust/kmersearch.cpp): `src/linclust/kmersearch.cpp`
- [Alignment](https://github.com/soedinglab/mmseqs2/blob/master/src/alignment/Main.cpp): `src/alignment/Main.cpp`
- [Multi-hit Search](https://github.com/soedinglab/mmseqs2/blob/master/src/multihit/MultiHitSearch.cpp): `src/multihit/MultiHitSearch.cpp`

### Clustering

- [Cluster Workflow](https://github.com/soedinglab/mmseqs2/blob/master/src/clustering/Main.cpp): `src/clustering/Main.cpp`
- [Linsearch Index](https://github.com/soedinglab/mmseqs2/blob/master/src/linclust/LinsearchIndexReader.cpp): `src/linclust/LinsearchIndexReader.cpp`

### Database and Taxonomy

- [Database Workflows](https://github.com/soedinglab/mmseqs2/blob/master/src/workflow/Databases.cpp): `src/workflow/Databases.cpp`
- [Database Reader](https://github.com/soedinglab/mmseqs2/blob/master/src/commons/DBReader.h): `src/commons/DBReader.h`
- [Taxonomy Tools](https://github.com/soedinglab/mmseqs2/blob/master/src/taxonomy/NcbiTaxonomy.cpp): `src/taxonomy/NcbiTaxonomy.cpp`
- [Taxonomy Reports](https://github.com/soedinglab/mmseqs2/blob/master/src/taxonomy/taxonomyreport.cpp): `src/taxonomy/taxonomyreport.cpp`

### Other components

- **CLI User**
- **Sequence Databases**
- **Search Results**

## Connections

- CLI User → Command Entry: invokes (evidence: `src/commons/Application.cpp`)
- Command Entry → Command Registry: dispatches
- Command Entry → Parameter Model: parses options
- CLI User → Easy Search: selects workflow
- Easy Search → Search Workflow: runs search
- Search Workflow → Database Reader: reads databases (evidence: `src/workflow/Search.cpp`)
- Search Workflow → Prefilter Command: runs prefilter
- Prefilter Command → K-mer Prefilter: uses matcher
- K-mer Prefilter → Search Results: emits hits
- CLI User → Cluster Workflow: selects clustering
- Cluster Workflow → K-mer Search: supports linclust
- K-mer Search → K-mer Prefilter: uses matcher (evidence: `src/linclust/kmersearch.cpp`)
- K-mer Search → Linsearch Index: reads index (evidence: `src/linclust/kmersearch.cpp`)
- CLI User → Database Workflows: manages databases
- Database Workflows → Sequence Databases: downloads datasets
- CLI User → Taxonomy Tools: assigns taxonomy
- Taxonomy Tools → Taxonomy Reports: supports reporting
- Search Workflow → Alignment: aligns candidates
- Search Workflow → Multi-hit Search: supports multi-hit
