Introduces session persistence via the `--session` option, allowing sampled sets to be restored. Implements chunked dumps and shared checkpointing for alignment and tally artifacts, ensuring state restoration upon interruption. Refines sampling logic and introduces serialization mechanisms for state management.
66 lines
2.6 KiB
Rust
66 lines
2.6 KiB
Rust
//! Sibling-annex construction algorithms — driven, one layer (or one
|
|
//! partition/layer sweep) at a time, by the traits in
|
|
//! [`crate::siblings::extensions`]. Kept apart from those traits (and from
|
|
//! the `siblingannex`/`entropy_annex`/`helpers` data model) the same way
|
|
//! `obikindexer` splits `algorithms` from `extensions`: this module depends
|
|
//! on the data model, never the reverse.
|
|
//!
|
|
//! [`annex`] builds the sibling-count/minorant annex itself; [`family_scan`]
|
|
//! is the shared cross-partition traversal every other consumer
|
|
//! (`entropy`, [`subsample`], [`alignment`], and future ones — cardinality,
|
|
//! stats) is built on; [`minorant_selection`] is the cheap annex-only
|
|
//! groundwork both `entropy` and `subsample` share; [`masking`] is
|
|
//! `subsample`/`alignment`'s shared post-hoc survival check and character
|
|
//! encoding.
|
|
|
|
mod alignment;
|
|
mod annex;
|
|
mod cardcomp;
|
|
mod entropy;
|
|
mod family_scan;
|
|
mod masking;
|
|
mod minorant_selection;
|
|
mod pairwise;
|
|
mod sankoff;
|
|
mod session_cache;
|
|
mod snp_distance;
|
|
mod stats;
|
|
mod subsample;
|
|
|
|
use obikidxcache::index_cache::IndexCache;
|
|
|
|
pub use alignment::SnpAlignment;
|
|
pub use cardcomp::{
|
|
cardinality_transition_probs, composition_transition_probs, pairwise_cost_matrix,
|
|
};
|
|
pub use pairwise::{BasePairTally, CardinalityTally, RawSnpDistanceOutput};
|
|
pub use sankoff::SankoffBundle;
|
|
pub use snp_distance::{GammaShape, SnpDistanceKind};
|
|
pub use stats::SiblingAnnexStats;
|
|
pub use subsample::{EntropyBias, SurvivingFamily};
|
|
|
|
pub(crate) use alignment::snp_pseudo_alignment;
|
|
pub(crate) use annex::build_layer_sibling_annex;
|
|
pub(crate) use entropy::{ensure_layer_entropy_annex, family_entropy, family_entropy_4};
|
|
pub(crate) use family_scan::{Selection, scan_layer_families};
|
|
pub(crate) use sankoff::sankoff_bundle;
|
|
pub(crate) use snp_distance::snp_distance;
|
|
pub(crate) use stats::{sibling_annex_stats, sibling_family_size_histogram};
|
|
|
|
/// Whether every layer number in `cache` fits in a `FamilyMask` field
|
|
/// (`< 7`) — a single fact about the whole index, decided once here so
|
|
/// every writer/reader of a per-layer `FamilyMask` field agrees. Layer
|
|
/// count is guaranteed identical across every partition (a merge adds one
|
|
/// layer to all of them at once), so the max over cached partitions speaks
|
|
/// for the whole index. Shared by every `extensions` impl that writes or
|
|
/// interprets that field (`SiblingExt::build_sibling_annex`,
|
|
/// `SiblingBuilder::ensure_entropy_annexes`), so they can never disagree.
|
|
pub(crate) fn is_fast_mode(cache: &IndexCache) -> bool {
|
|
cache
|
|
.partitions()
|
|
.filter_map(|p| cache.n_layer(p))
|
|
.max()
|
|
.unwrap_or(0)
|
|
<= 7
|
|
}
|