refactor: relocate partition iterator and expose graph builder API

Move the partition iterator implementation from obikdump to obikfilter, updating imports and exposing the type publicly. Add obikidxcache as a local dependency for obikfilter. In obikindexer, expose the new build_layer_from_kmers function to enable shared graph-building logic across pipelines without code duplication.
This commit is contained in:
Eric Coissac committed 2026-08-26 09:39:02 +02:00
1 parent 16ade823d6
commit 294f132a0a
8 files changed
+35 -14

No files matched your search

+21
View File
@@ -148,3 +148,24 @@ pub fn materialize_layer(
debug!("materialize_layer: MPHF build done");
Ok(n)
}
// ── build_layer_from_kmers ──────────────────────────────────────────────────
/// Build a layer's identity (unitigs + MPHF + evidence) straight from an
/// already-filtered kmer iterator — no file I/O, no abundance filtering:
/// the caller has already decided which kmers survive (e.g. abundance
/// filtering in [`crate::extensions::build_index_layer`], metadata-based
/// filtering in `obikfilter::Filter`). Both share this same construction
/// tail instead of duplicating the graph-building mechanism.
pub fn build_layer_from_kmers(
kmers: impl Iterator<Item = CanonicalKmer>,
layer_dir: &Path,
block_bits: u8,
evidence: &IndexMode,
) -> OKIResult<usize> {
let mut g = GraphDeBruijn::new();
for kmer in kmers {
g.push(kmer);
}
materialize_layer(g, layer_dir, block_bits, evidence)
}
+1 -1
View File
@@ -16,4 +16,4 @@ pub mod algorithms;
pub(crate) mod extensions;
pub mod graph_pipeline;
pub use graph_pipeline::{build_graph, materialize_layer, write_graph_as_unitigs};
pub use graph_pipeline::{build_graph, build_layer_from_kmers, materialize_layer, write_graph_as_unitigs};