seq-hash

Crates.ioseq-hash
lib.rsseq-hash
version0.1.2
created_at2025-09-26 12:10:12.666877+00
updated_at2026-01-20 16:09:41.981924+00
descriptionA SIMD-accelerated library to compute hashes of DNA sequences
homepage
repositoryhttps://github.com/rust-seq/seq-hash
max_upload_size
id1855807
size44,997
Ragnar Groot Koerkamp (RagnarGrootKoerkamp)

documentation

README

seq-hash

crates.io docs

A SIMD-accelerated library for iterating over k-mer hashes of DNA sequences, building on packed_seq. Building block for simd-minimizers.

Paper: Please cite the simd-minimizers paper, for which this crate was developed:

Requirements

This library requires AVX2 or NEON instruction sets, which, on x64, requires either target-cpu=native or target-cpu=x86-64-v3. See this README for details and this blog for background. The same restrictions apply when using seq-hash in a larger project.

RUSTFLAGS="-C target-cpu=native" cargo run --release

Usage example

Full documentation can be found on docs.rs.

use packed_seq::{AsciiSeqVec, PackedSeqVec, SeqVec};
use seq_hash::{KmerHasher, NtHasher};

let seq = b"ACGGCAGCGCATATGTAGT";
let packed_seq = PackedSeqVec::from_ascii(seq);

let k = 3;
// Default `NtHasher` is canonical.
let hasher = <NtHasher>::new(k);

// Consider a 'context' of a single kmer.
let hashes: Vec<_> = hasher.hash_kmers_simd(packed_seq.as_slice(), 1).collect();
assert_eq!(hashes.len(), seq.len() - (k-1)
Commit count: 42

cargo fmt