pub struct DiscreteFld { /* private fields */ }Expand description
Order-independent accumulator for deriving a fragment-length distribution (and library format) from uniquely-mapped proper pairs.
Unlike FragmentLengthDistribution — which accumulates in log space and
is required for the online phase (it folds in per-fragment forgetting mass and
is read per fragment) — this stores plain integer counts per length,
bucketed by orientation. Integer increments are commutative, so the tallies
are independent of thread / chunk order; the FLD is then built once,
deterministically (fixed length order), in finish. Keeping
it a separate type means the online FLD’s float/log-space accumulation is
never disturbed, and no runtime dispatch is needed.
Implementations§
Source§impl DiscreteFld
impl DiscreteFld
Sourcepub fn new(fld_max: usize) -> Self
pub fn new(fld_max: usize) -> Self
Create an accumulator covering raw fragment lengths [0, fld_max].
Sourcepub fn add(&self, len: usize, is_fw: bool, mate_fw: bool)
pub fn add(&self, len: usize, is_fw: bool, mate_fw: bool)
Record one uniquely-mapped proper pair from its mate strands: fragment
length, orientation bucket, and observed format (derived from is_fw /
mate_fw, mirroring the RAD reader’s rad_frag_format so the mapping pass
and the RAD-derive path agree). Works in sketch mode, where no precomputed
LibraryFormat is available. Thread-safe and order-independent.
Sourcepub fn finish(
&self,
fld_mean: f64,
fld_sd: f64,
) -> (FragmentLengthDistribution, Option<LibraryFormat>)
pub fn finish( &self, fld_mean: f64, fld_sd: f64, ) -> (FragmentLengthDistribution, Option<LibraryFormat>)
Build the FLD from the majority-orientation bucket (deterministically, in
fixed length order) and infer the library format from the format tally.
fld_mean/fld_sd seed the prior. Returns the cached FLD and the detected
format (None when no proper pairs were seen).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DiscreteFld
impl RefUnwindSafe for DiscreteFld
impl Send for DiscreteFld
impl Sync for DiscreteFld
impl Unpin for DiscreteFld
impl UnsafeUnpin for DiscreteFld
impl UnwindSafe for DiscreteFld
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.