ClipStat

Struct ClipStat 

Source
pub struct ClipStat { /* private fields */ }
Expand description

An object to store statistics for base clipping on an alignment

Implementations§

Source§

impl ClipStat

Source

pub fn new(leading_clipped: Vec<i64>, trailing_clipped: Vec<i64>) -> Self

Creat a new ClipStat object for an alignment

§Arguments
  • leading_clipped: a list of [number of 5’ soft clipped bases, number of 5’ hard clipped bases]
  • trailing_clipped: a list of [number of 3’ soft clipped bases, number of 3’ hard clipped bases]
§Return:

A ClipStat object

§Example
use filter_clipped::clipping::ClipStat;
let clip_stat = ClipStat::new(
    vec![0,1],
    vec![0,2],
);
assert_eq!(clip_stat.left(), 1);
assert_eq!(clip_stat.right(), 2);
assert_eq!(clip_stat.total_clipped(), 3);
Source

pub fn right_fraction(&self, seq_len: f64) -> Result<f64, String>

Return the fraction of 3’ clipped base relative to the sequence length

§Argument
  • seq_len: sequence length of the alignment
§Return:
  • f64 fraction of 3’ clipped base
§Example
use filter_clipped::clipping::ClipStat;
let clip_stat = ClipStat::new(
    vec![0,1],
    vec![0,2],
);
assert_eq!(clip_stat.right_fraction(10.0).unwrap(), 0.2);
Source

pub fn left_fraction(&self, seq_len: f64) -> Result<f64, String>

Return the fraction of 5’ clipped base relative to the sequence length

§Argument
  • seq_len: sequence length of the alignment
§Return:
  • f64 fraction of 5’ clipped base
§Example
use filter_clipped::clipping::ClipStat;
let clip_stat = ClipStat::new(
    vec![0,1],
    vec![0,2],
);
assert_eq!(clip_stat.left_fraction(10.0).unwrap(), 0.1);
Source

pub fn total_fraction(&self, seq_len: f64) -> Result<f64, String>

Return the fraction of total clipped base relative to the sequence length

§Argument
  • seq_len: sequence length of the alignment
§Return:
  • f64 fraction of 5’ clipped base
§Example
use filter_clipped::clipping::ClipStat;
let clip_stat = ClipStat::new(
    vec![0,1],
    vec![0,2],
);
assert_eq!(clip_stat.total_fraction(10.0).unwrap(), 0.3);
Source

pub fn left(&self) -> i64

Expose left

§Example
use filter_clipped::clipping::ClipStat;
let clip_stat = ClipStat::new(
    vec![0,1],
    vec![0,2],
);
assert_eq!(clip_stat.left(), 1);
Source

pub fn right(&self) -> i64

Expose right

§Example
use filter_clipped::clipping::ClipStat;
let clip_stat = ClipStat::new(
    vec![0,1],
    vec![0,2],
);
assert_eq!(clip_stat.right(), 2);
Source

pub fn total_clipped(&self) -> i64

Expose total_clipped

§Example
use filter_clipped::clipping::ClipStat;
let clip_stat = ClipStat::new(
    vec![0,1],
    vec![0,2],
);
assert_eq!(clip_stat.total_clipped(), 3);

Trait Implementations§

Source§

impl Debug for ClipStat

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