Struct ConditionSummary

Source
pub struct ConditionSummary {
Show 14 fields pub name: String, pub total_reads: usize, pub mean_read_lengths: MeanReadLengths, pub off_target_read_count: usize, pub on_target_read_count: usize, pub off_target_percent: f64, pub off_target_yield: usize, pub on_target_yield: usize, pub off_target_mean_read_quality: f64, pub on_target_mean_read_quality: f64, pub n50: usize, pub on_target_n50: usize, pub off_target_n50: usize, pub contigs: HashMap<String, ContigSummary>,
}
Expand description

Represents a summary of sequencing data, including various metrics related to the output of the experiment.

Fields§

§name: String

The name or identifier of the sequencing data.

§total_reads: usize

The total number of reads in the sequencing data.

§mean_read_lengths: MeanReadLengths

Mean read lengths

§off_target_read_count: usize

The count of reads that are mapped off the target regions (off-target reads).

§on_target_read_count: usize

The count of reads that are mapped to the target regions (on-target reads).

§off_target_percent: f64

The percentage of off-target reads in the sequencing data.

§off_target_yield: usize

The total yield (base pairs) of off-target reads in the sequencing data.

§on_target_yield: usize

The total yield (base pairs) of on-target reads in the sequencing data.

§off_target_mean_read_quality: f64

The mean read quality of off-target reads.

§on_target_mean_read_quality: f64

The mean read quality of on-target reads.

§n50: usize

The N50 metric for the entire dataset, representing the length at which the cumulative sum of contig lengths reaches half of the total assembly length.

§on_target_n50: usize

The N50 metric for on-target reads, representing the length at which the cumulative sum of contig lengths reaches half of the total assembly length for on-target reads.

§off_target_n50: usize

The N50 metric for off-target reads, representing the length at which the cumulative sum of contig lengths reaches half of the total assembly length for off-target reads.

§contigs: HashMap<String, ContigSummary>

A vector of ContigSummary representing summaries of individual contigs or sequences in the sequencing data.

Implementations§

Source§

impl ConditionSummary

Source

pub fn update( &mut self, paf: PafRecord, on_target: bool, ) -> Result<(), Box<dyn Error + 'static>>

Update the ConditionSummary with information from the provided PafRecord.

This method updates the fields of the ConditionSummary based on the information from the given PafRecord. It increments the appropriate read counts (on-target or off-target), calculates the mean read lengths and read qualities, updates the total reads count, and calculates the off-target percentage.

§Arguments
  • paf - The PafRecord containing the information about the alignment.
  • on_target - A boolean flag indicating whether the alignment is on-target or off-target.
§Returns

This function returns a [DynResult] (a dynamic result that can contain any error). If the operation is successful, the DynResult will hold an Ok(()). Otherwise, it will hold an Err containing a helpful error message.

Source

pub fn new(name: String) -> Self

Create a new Summary instance with default values for all fields except name.

§Arguments
  • name - The name of the summary.
Source

pub fn name(&self) -> &str

Get the name or identifier of the sequencing data.

Source

pub fn set_name(&mut self, name: String)

Set the name or identifier of the sequencing data.

Source

pub fn total_reads(&self) -> usize

Get the total number of reads in the sequencing data.

Source

pub fn add_total_reads(&mut self, total_reads: usize)

Set the total number of reads in the sequencing data.

Source

pub fn off_target_read_count(&self) -> usize

Get the count of reads that are mapped off the target regions (off-target reads).

Source

pub fn set_off_target_read_count(&mut self, off_target_read_count: usize)

Set the count of reads that are mapped off the target regions (off-target reads).

Source

pub fn on_target_read_count(&self) -> usize

Get the count of reads that are mapped to the target regions (on-target reads).

Source

pub fn set_on_target_read_count(&mut self, on_target_read_count: usize)

Set the count of reads that are mapped to the target regions (on-target reads).

Source

pub fn off_target_percent(&self) -> f64

Get the percentage of off-target reads in the sequencing data.

Source

pub fn set_off_target_percent(&mut self, off_target_percent: f64)

Set the percentage of off-target reads in the sequencing data.

Source

pub fn off_target_yield(&self) -> usize

Get the total yield (base pairs) of off-target reads in the sequencing data.

Source

pub fn set_off_target_yield(&mut self, off_target_yield: usize)

Set the total yield (base pairs) of off-target reads in the sequencing data.

Source

pub fn on_target_yield(&self) -> usize

Get the total yield (base pairs) of on-target reads in the sequencing data.

Source

pub fn set_on_target_yield(&mut self, on_target_yield: usize)

Set the total yield (base pairs) of on-target reads in the sequencing data.

Source

pub fn mean_read_length(&self) -> usize

Get the mean read length of all reads

Source

pub fn off_target_mean_read_length(&self) -> usize

Get the mean read length of off-target reads.

Source

pub fn on_target_mean_read_length(&self) -> usize

Get the mean read length of on-target reads.

Source

pub fn off_target_mean_read_quality(&self) -> f64

Get the mean read quality of off-target reads.

Source

pub fn set_off_target_mean_read_quality( &mut self, off_target_mean_read_quality: f64, )

Set the mean read quality of off-target reads.

Source

pub fn on_target_mean_read_quality(&self) -> f64

Get the mean read quality of on-target reads.

Source

pub fn set_on_target_mean_read_quality( &mut self, on_target_mean_read_quality: f64, )

Set the mean read quality of on-target reads.

Source

pub fn n50(&self) -> usize

Get the N50 metric for the entire dataset.

Source

pub fn set_n50(&mut self, n50: usize)

Set the N50 metric for the entire dataset.

Source

pub fn on_target_n50(&self) -> usize

Get the N50 metric for on-target reads.

Source

pub fn set_on_target_n50(&mut self, on_target_n50: usize)

Set the N50 metric for on-target reads.

Source

pub fn off_target_n50(&self) -> usize

Get the N50 metric for off-target reads.

Source

pub fn set_off_target_n50(&mut self, off_target_n50: usize)

Set the N50 metric for off-target reads.

Source

pub fn contigs(&self) -> &HashMap<String, ContigSummary>

Get a reference to the vector of ContigSummary.

Source

pub fn contigs_mut(&mut self) -> &mut HashMap<String, ContigSummary>

Get a mutable reference to the vector of ContigSummary.

Source

pub fn get_or_add_contig( &mut self, contig: &str, length: usize, ) -> &mut ContigSummary

Get the ContigSummary associated with the given contig name or add a new ContigSummary with the specified name and length if it doesn’t exist.

§Arguments
  • contig - The name of the contig.
  • length - The length of the contig.
§Returns

A reference to the ContigSummary associated with the contig name.

§Example
use std::collections::HashMap;
use your_crate::ContigSummary;

let mut contig_map: HashMap<String, ContigSummary> = HashMap::new();

// Get an existing contig or add a new one if it doesn't exist
let contig_name = "chr1".to_string();
let contig_length = 1000;
let contig_summary = contig_map.get_or_add_contig(contig_name.clone(), contig_length);

// Now you can modify the ContigSummary fields or access its properties
println!("Contig name: {}", contig_summary.name);
println!("Contig length: {}", contig_summary.length);
Source

pub fn total_yield(&self) -> usize

get the total yield

Trait Implementations§

Source§

impl Debug for ConditionSummary

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for ConditionSummary

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> Ungil for T
where T: Send,