Skip to main content

RleCoverage

Struct RleCoverage 

Source
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

Source

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).

Source

pub fn from_depths(depths: &[u32]) -> Self

Build an RLE coverage vector from a dense depth array.

Source

pub fn get(&self, position: u64) -> u32

Get the coverage depth at a specific position.

Returns 0 if the position is out of range.

Source

pub fn mean_coverage(&self) -> f64

Mean coverage across all positions.

Source

pub fn bases_above(&self, threshold: u32) -> u64

Number of bases with depth above a threshold.

Source

pub fn to_vec(&self) -> Vec<u32>

Expand the RLE coverage to a dense vector.

Source

pub fn len(&self) -> u64

Total length of the coverage vector.

Source

pub fn is_empty(&self) -> bool

Whether the coverage vector is empty.

Source

pub fn num_runs(&self) -> usize

Number of RLE runs.

Trait Implementations§

Source§

impl Clone for RleCoverage

Source§

fn clone(&self) -> RleCoverage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RleCoverage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.