Inferensys

Glossary

FracMinHash

A sketching technique that selects a fraction of all k-mer hash values falling below a defined abundance threshold, providing a robust and scalable method for estimating the containment index and average nucleotide identity between two genomic datasets.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
SKETCHING ALGORITHM

What is FracMinHash?

A sketching technique that selects a fraction of all k-mer hash values falling below a defined abundance threshold, providing a robust and scalable method for estimating the containment index and average nucleotide identity between two genomic datasets.

FracMinHash is a locality-sensitive hashing technique that subsamples a k-mer set by retaining only those hash values that fall below a specified fraction s of the total hash space, creating a compact, unbiased sketch. Unlike standard MinHash, which selects a fixed number of minimum hash values, FracMinHash scales the sketch size proportionally to the original set cardinality, preserving abundance information critical for downstream analyses.

This method underpins tools like sourmash and enables efficient estimation of the containment index—the fraction of k-mers from one dataset present in another—without storing full k-mer sets. By adjusting the scaled parameter s, users trade off sketch size against resolution, making FracMinHash particularly effective for large-scale metagenomic comparisons, Average Nucleotide Identity (ANI) estimation, and taxonomic profiling where both presence and relative coverage matter.

FRACMINHASH EXPLAINED

Frequently Asked Questions

Clear, technically precise answers to the most common questions about the FracMinHash sketching technique, its relationship to MinHash, and its role in large-scale genomic comparisons.

FracMinHash is a k-mer sketching technique that selects a fraction of all k-mer hash values falling below a defined abundance threshold, providing a robust and scalable method for estimating the containment index and average nucleotide identity (ANI) between two genomic datasets. Unlike standard MinHash, which selects a fixed number of minimum hash values, FracMinHash defines a scaled parameter s that determines the fraction of the hash space retained. Specifically, it keeps all hash values that are less than H / s, where H is the maximum possible hash value. This scaling approach ensures that the sketch size grows linearly with the size of the input dataset, making it directly comparable across datasets of different sizes without the need for normalization. The technique is foundational to tools like sourmash and Mash Screen, enabling rapid containment queries and taxonomic profiling at terabase scale.

SKETCHING FUNDAMENTALS

Key Properties of FracMinHash

FracMinHash is a downsampled MinHash technique that selects a fraction of k-mer hash values falling below a defined abundance threshold, enabling scalable and robust estimation of genomic similarity metrics like containment and average nucleotide identity (ANI).

01

Fractional Downsampling Mechanism

Unlike standard MinHash which selects a fixed number of minimum hash values, FracMinHash selects all k-mer hash values that fall below a fraction threshold (s) of the maximum possible hash value. This creates a sketch whose size scales linearly with the number of distinct k-mers in the input dataset, providing a scale-invariant representation.

  • Threshold parameter (s): Defines the fraction of the hash space retained (e.g., s=0.001 retains 0.1% of k-mers)
  • Dynamic sketch size: Larger genomes produce proportionally larger sketches
  • Hash function: Typically uses MurmurHash3 or xxHash for uniform distribution
02

Containment Index Estimation

FracMinHash provides an unbiased estimator of the containment index—the fraction of k-mers from one dataset (the query) that are present in another (the reference). This is computed as the ratio of intersecting hash values to the total hash values in the query sketch.

  • Formula: Containment ≈ |Sketch(A) ∩ Sketch(B)| / |Sketch(A)|
  • Key advantage: Does not require the reference sketch to be a fixed size
  • Use case: Determining what fraction of a metagenomic sample matches a known genome
03

Average Nucleotide Identity (ANI) Estimation

FracMinHash sketches enable rapid ANI estimation without expensive base-level alignment. By comparing the containment and Jaccard indices derived from sketches, tools like sourmash and skani can estimate ANI with high accuracy.

  • Mash distance: Derived from Jaccard index to estimate mutation rate
  • ANI formula: ANI ≈ 1 + (1/k) * ln(Jaccard) for sufficiently large k
  • Benchmark: Achieves >99% correlation with BLAST-based ANI for genomes above 90% identity
  • Throughput: Processes thousands of genomes per minute on consumer hardware
04

Abundance-Weighted Variants

Standard FracMinHash treats all k-mers equally, but abundance-weighted FracMinHash variants incorporate k-mer multiplicity information to improve distance estimation for metagenomic samples with varying coverage depths.

  • Weighted MinHash: Extends FracMinHash to preserve relative abundance signals
  • Confidence intervals: Abundance weighting reduces variance in low-coverage regions
  • Implementation: Used in tools like sourmash gather for metagenomic decomposition
  • Trade-off: Increased sketch size for improved resolution of closely related strains
05

Scaled MinHash Implementation

The scaled MinHash variant of FracMinHash uses a fixed sampling rate (e.g., 1 in 1000) rather than a fixed sketch size, ensuring that sketches from datasets of different sizes remain directly comparable without normalization.

  • Parameter: Scaled factor (e.g., scaled=1000 retains 1/1000th of k-mers)
  • Merge compatibility: Sketches with identical scaled parameters can be combined via union operations
  • Streaming support: Enables sketching of unbounded data streams without pre-knowledge of dataset size
  • Adoption: Core algorithm in sourmash for large-scale genomic indexing
06

Error Robustness and False Positive Control

FracMinHash sketches exhibit inherent error tolerance because sequencing errors generate random k-mers that are unlikely to consistently hash below the fraction threshold across multiple samples. This provides natural denoising without explicit quality filtering.

  • Error k-mers: Low-abundance erroneous k-mers are stochastically excluded from the sketch
  • False positive rate: Controllable via the fraction parameter (s) and k-mer size (k)
  • k-mer size selection: Larger k (e.g., k=31) reduces random collisions between unrelated genomes
  • Practical impact: Enables accurate comparisons directly from raw sequencing reads without assembly
SKETCHING TECHNIQUE COMPARISON

FracMinHash vs. MinHash vs. ModHash

A technical comparison of k-mer hashing strategies used for genomic distance estimation, containment index calculation, and large-scale sequence comparison.

FeatureFracMinHashMinHashModHash

Selection Criterion

Hash value below scaled abundance threshold (fraction of k-mer space)

Global minimum hash values across all k-mers

Hash values divisible by a fixed denominator (modulo condition)

Sketch Size Determinant

User-defined scaled parameter (s) controlling fraction of retained hashes

User-defined sketch size (k) controlling number of minima retained

User-defined modulo denominator (d) controlling 1/d retention rate

Primary Use Case

Containment index estimation and Average Nucleotide Identity (ANI)

Jaccard similarity estimation between sets

Subsampling k-mer sets with uniform probability

Containment Index Support

ANI Estimation

Jaccard Similarity Estimation

Downsampling Bias

Low (fraction-based selection preserves abundance distribution)

Low (consistent minima across similar sets)

Moderate (uniform subsampling independent of abundance)

Implementation in Sourmash

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.