How sourmash-bio/sourmash works
sourmash is a Python/Rust genomic k-mer analysis toolkit. A typical workflow sketches sequence data into signatures, stores or indexes signatures, then searches, gathers, compares, or classifies results. The map also preserves documented metagenomic profiling, ANI, taxonomy, and signature-management capabilities. Relationships shown from README statements are cited there; source-level links use the available excerpts or SOURCE INDEX references, so unsampled implementation details are not represented as verified calls.
Main entry points: commands.py CLI commands · minhash.py MinHash engine · search.py Search and gather · __init__.py Index API
Components 20
Sketching and signatures
- Sketch commands
src/sourmash/cli/sketch/dna.py - Sketch generation
src/sourmash/command_sketch.py - MinHash engine
src/sourmash/minhash.py - Signatures
src/sourmash/signature.py - Core signatures
src/core/src/signature.rs
Search and analysis
- Search and gather
src/sourmash/search.py - Comparison
src/sourmash/compare.py - Distance and ANI
src/sourmash/distance_utils.py
Indexes and storage
- Collection manifest
src/sourmash/manifest.py - Index API
src/sourmash/index/__init__.py - SQLite index
src/sourmash/index/sqlite_index.py - Rust reverse index
src/core/src/index/revindex/mod.rs - Signature storage
src/core/src/storage/mod.rs - SBT indexes
src/sourmash/sbt.py
Taxonomy and LCA
- LCA database
src/sourmash/lca/lca_db.py - Taxonomy analysis
src/sourmash/tax/tax_utils.py - LCA commands
src/sourmash/cli/lca/index.py - Taxonomy commands
src/sourmash/tax/__main__.py
Other components
- Researcher
- CLI commands
src/sourmash/commands.py
Connections 22
- Researcher → CLI commands: runs
README.md - CLI commands → Sketch commands: dispatches
- Sketch commands → Sketch generation: requests sketches
- Sketch generation → Signatures: creates
- Signatures → MinHash engine: contains sketches
src/sourmash/signature.py - Core signatures → MinHash engine: adds sequences
src/core/src/signature.rs - CLI commands → Search and gather: runs search or gather
README.md - Search and gather → Index API: searches index
src/sourmash/index/__init__.py - Search and gather → MinHash engine: compares sketches
src/sourmash/search.py - CLI commands → Comparison: runs comparison
README.md - Comparison → Distance and ANI: calculates distances
- Distance and ANI → MinHash engine: uses sketch metrics
src/sourmash/minhash.py - Index API → Collection manifest: selects signatures
src/sourmash/index/__init__.py - SQLite index → Collection manifest: uses manifest
src/sourmash/index/sqlite_index.py - SQLite index → Rust reverse index: queries hashes
- Signature storage → Core signatures: loads signatures
src/core/src/storage/mod.rs - Index API → SBT indexes: supports SBT indexes
- CLI commands → LCA commands: runs LCA commands
- LCA commands → LCA database: builds index
- LCA database → Taxonomy analysis: uses taxonomy utilities
src/sourmash/lca/lca_db.py - CLI commands → Taxonomy commands: runs taxonomy analysis
- Taxonomy commands → Taxonomy analysis: uses taxonomy
src/sourmash/tax/__main__.py