pub struct ClipStat { /* private fields */ }Expand description
An object to store statistics for base clipping on an alignment
Implementations§
Source§impl ClipStat
impl ClipStat
Sourcepub fn new(leading_clipped: Vec<i64>, trailing_clipped: Vec<i64>) -> Self
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);Sourcepub fn right_fraction(&self, seq_len: f64) -> Result<f64, String>
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:
f64fraction 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);Sourcepub fn left_fraction(&self, seq_len: f64) -> Result<f64, String>
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:
f64fraction 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);Sourcepub fn total_fraction(&self, seq_len: f64) -> Result<f64, String>
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:
f64fraction 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);Sourcepub fn left(&self) -> i64
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);Sourcepub fn right(&self) -> i64
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);Sourcepub fn total_clipped(&self) -> i64
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§
Auto Trait Implementations§
impl Freeze for ClipStat
impl RefUnwindSafe for ClipStat
impl Send for ClipStat
impl Sync for ClipStat
impl Unpin for ClipStat
impl UnwindSafe for ClipStat
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