feat: extract k-mer entropy computation into new obikentropy crate
Extracts streaming entropy logic and sliding-window frequency tracking from obiskbuilder into a dedicated obikentropy crate. Introduces an EntropyTracker accumulator for O(1) per-base normalized Shannon entropy, replaces inline rolling statistics with delegated state management, and updates workspace dependencies across obikindex, obikpartitionner, and obiskbuilder. Adds criterion benchmarks to validate the refactored pipeline throughput.
This commit is contained in:
1 parent
e725523898
commit
912f788f7f
17 files changed
+482
-305
No files matched your search
@@ -13,6 +13,7 @@ obikrope = { path = "../obikrope" }
|
||||
niffler = "3.0.0"
|
||||
remove_dir_all = "0.8"
|
||||
obikseq = { path = "../obikseq" }
|
||||
obikentropy = { path = "../obikentropy" }
|
||||
obiskbuilder = { path = "../obiskbuilder" }
|
||||
obiskio = { path = "../obiskio" }
|
||||
obidebruinj = { path = "../obidebruinj" }
|
||||
|
||||
@@ -277,7 +277,7 @@ impl KmerFilter for GroupQuorumFilter {
|
||||
|
||||
/// Reject k-mers with normalized entropy below `theta` — the same complexity
|
||||
/// metric `obikmer index`'s `--theta`/`--level-max` apply *during* superkmer
|
||||
/// construction (see [`obiskbuilder::KmerEntropy`]), applied here after the
|
||||
/// construction (see [`obikentropy::KmerEntropy`]), applied here after the
|
||||
/// fact, to k-mers already committed to a built index.
|
||||
///
|
||||
/// Unlike every other filter in this module, this one needs the k-mer's own
|
||||
@@ -292,7 +292,7 @@ pub struct MinComplexity {
|
||||
|
||||
impl KmerFilter for MinComplexity {
|
||||
fn passes(&self, kmer: CanonicalKmer, _row: &[u32], _n_genomes: usize) -> bool {
|
||||
use obiskbuilder::KmerEntropy;
|
||||
use obikentropy::KmerEntropy;
|
||||
kmer.entropy(self.level_max) >= self.theta
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user