Push zunrplorkwkt #70
Generated
+1
@@ -1543,6 +1543,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"obicompactvec",
|
||||
"obikentropy",
|
||||
"obikidxcache",
|
||||
"obikindex",
|
||||
"obikseq",
|
||||
"obiskio",
|
||||
|
||||
@@ -8,7 +8,7 @@ use obikindex::KmerIndex;
|
||||
use obikidxcache::index_cache::IndexCache;
|
||||
use obikfilter::KmerFilter;
|
||||
|
||||
use crate::partition_iter::FilteredPartitionIter;
|
||||
use obikfilter::FilteredPartitionIter;
|
||||
|
||||
/// Raw content export of a `KmerIndex` — `KmerIndex` is a foreign type
|
||||
/// (`obikindex`), so this is an extension trait rather than an inherent `impl`.
|
||||
|
||||
@@ -6,6 +6,3 @@
|
||||
//! reverse), same pattern as `obikindexer`/`obikquery`.
|
||||
|
||||
mod dump;
|
||||
mod partition_iter;
|
||||
|
||||
pub use partition_iter::FilteredPartitionIter;
|
||||
|
||||
@@ -10,3 +10,4 @@ obikseq = { path = "../obikseq" }
|
||||
obiskio = { path = "../obiskio" }
|
||||
obitaxonomy = { path = "../obitaxonomy" }
|
||||
obikentropy = { path = "../obikentropy" }
|
||||
obikidxcache = { path = "../obikidxcache" }
|
||||
|
||||
@@ -3,19 +3,20 @@
|
||||
//! Orthogonal to genome-column selection/aggregation (`obikselect`), which
|
||||
//! operates on already-retained k-mers.
|
||||
//!
|
||||
//! [`filter`] (the `KmerFilter` trait + its implementations) depends only
|
||||
//! on `obicompactvec`/`obikseq`, not on `obikindex`. The partition/layer
|
||||
//! iteration that actually runs these filters over an index
|
||||
//! (`iter_partition_kmers`, `iter_partition_kmers_located`) lives in
|
||||
//! `obikdump` instead (`FilteredPartitionIter`) — it needs `obikidxcache`'s
|
||||
//! `IndexCache` to read a *complete* source index, which this crate has no
|
||||
//! reason to depend on.
|
||||
//! [`filter`] (the `KmerFilter` trait + its implementations) is the pure
|
||||
//! judging logic. [`partition_iter`] (`FilteredPartitionIter`) is the read
|
||||
//! side that actually runs those filters over a *complete* source index's
|
||||
//! partitions/layers, batched through `obikidxcache::IndexCache` for
|
||||
//! locality — used both by `obikdump` (CSV export) and by this crate's own
|
||||
//! `Filter` algorithm (index-to-index rebuild).
|
||||
|
||||
mod filter;
|
||||
mod partition_iter;
|
||||
mod predicate;
|
||||
|
||||
pub use filter::{
|
||||
GroupQuorumFilter, KmerFilter, MaxGenomeCount, MaxGenomeFraction, MaxTotalCount,
|
||||
MinComplexity, MinGenomeCount, MinGenomeFraction, MinTotalCount, passes_all,
|
||||
};
|
||||
pub use partition_iter::FilteredPartitionIter;
|
||||
pub use predicate::{GenomeSelector, GroupFilterParams, MetaPred, Selection};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Filtered, batch-oriented iteration over an already-cached index's
|
||||
//! partitions/layers — the read side of `obikfilter`'s `KmerFilter`s.
|
||||
//! partitions/layers — the read side of [`crate::KmerFilter`]s.
|
||||
//! `IndexCache` is a foreign type (`obikidxcache`), so this is an extension
|
||||
//! trait rather than an inherent `impl`.
|
||||
//!
|
||||
@@ -13,7 +13,7 @@ use obikindex::layer::{KmerLayer, LayerContent};
|
||||
use obikidxcache::index_cache::IndexCache;
|
||||
use obikseq::CanonicalKmer;
|
||||
|
||||
use obikfilter::{KmerFilter, passes_all};
|
||||
use crate::filter::{KmerFilter, passes_all};
|
||||
|
||||
/// Kmers pulled per batch from a layer before filtering — keeps matrix reads
|
||||
/// grouped by (partition, layer) for locality instead of hopping row to row
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user