pub struct RleCoverage { /* private fields */ }Expand description
Run-length encoded coverage vector.
Stores coverage depth as a sequence of (depth, length) runs. This is memory-efficient for genome-wide coverage where long runs of identical depth are common (e.g., depth=0 in intergenic regions).
Implementations§
Source§impl RleCoverage
impl RleCoverage
Sourcepub fn from_intervals(intervals: &[GenomicInterval], chrom_length: u64) -> Self
pub fn from_intervals(intervals: &[GenomicInterval], chrom_length: u64) -> Self
Build an RLE coverage vector from a set of intervals on a chromosome.
Each interval contributes +1 to all positions it covers. The resulting
coverage vector spans [0, chrom_length).
Sourcepub fn from_depths(depths: &[u32]) -> Self
pub fn from_depths(depths: &[u32]) -> Self
Build an RLE coverage vector from a dense depth array.
Sourcepub fn get(&self, position: u64) -> u32
pub fn get(&self, position: u64) -> u32
Get the coverage depth at a specific position.
Returns 0 if the position is out of range.
Sourcepub fn mean_coverage(&self) -> f64
pub fn mean_coverage(&self) -> f64
Mean coverage across all positions.
Sourcepub fn bases_above(&self, threshold: u32) -> u64
pub fn bases_above(&self, threshold: u32) -> u64
Number of bases with depth above a threshold.
Trait Implementations§
Source§impl Clone for RleCoverage
impl Clone for RleCoverage
Source§fn clone(&self) -> RleCoverage
fn clone(&self) -> RleCoverage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RleCoverage
impl RefUnwindSafe for RleCoverage
impl Send for RleCoverage
impl Sync for RleCoverage
impl Unpin for RleCoverage
impl UnsafeUnpin for RleCoverage
impl UnwindSafe for RleCoverage
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
Mutably borrows from an owned value. Read more