feat: implement partition-based merge command for k-mer indices

Implements a new `merge` command that aggregates k-mer counts and presence/absence matrices from multiple source indices using a parallelized, partition-based algorithm. Adds CLI progress bars and execution timing across the bootstrap, spectrum rebuild, and merge phases. Updates logging to report the aggregate genome count and introduces a bounds check in the perfect hash layer to safely return `None` for unknown k-mers, preventing out-of-bounds access in downstream operations.
This commit is contained in:
Eric Coissac committed 2026-05-21 14:55:38 +02:00
1 parent 11182005a2
commit 9e1d6f2f25
4 files changed
+64 -20

No files matched your search

+9 -3
View File
@@ -55,9 +55,15 @@ pub fn run(args: MergeArgs) {
set_k(sources[0].kmer_size());
set_m(sources[0].minimizer_size());
info!("merging {} indexes → {}", sources.len(), args.output.display());
let rep = Reporter::new();
KmerIndex::merge(&args.output, &source_refs, mode, args.force, args.rename_duplicates).unwrap_or_else(|e| {
let n_genomes: usize = sources.iter().map(|s| s.meta().genomes.len()).sum();
info!(
"merging {} index(es), {} genome(s) total → {}",
sources.len(), n_genomes, args.output.display()
);
let mut rep = Reporter::new();
KmerIndex::merge(&args.output, &source_refs, mode, args.force, args.rename_duplicates, &mut rep).unwrap_or_else(|e| {
eprintln!("error merging: {e}");
std::process::exit(1);
});