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
impl ConditionSummary
Sourcepub fn update(
&mut self,
paf: PafRecord,
on_target: bool,
) -> Result<(), Box<dyn Error + 'static>>
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
- ThePafRecord
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.
Sourcepub fn new(name: String) -> Self
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.
Sourcepub fn total_reads(&self) -> usize
pub fn total_reads(&self) -> usize
Get the total number of reads in the sequencing data.
Sourcepub fn add_total_reads(&mut self, total_reads: usize)
pub fn add_total_reads(&mut self, total_reads: usize)
Set the total number of reads in the sequencing data.
Sourcepub fn off_target_read_count(&self) -> usize
pub fn off_target_read_count(&self) -> usize
Get the count of reads that are mapped off the target regions (off-target reads).
Sourcepub fn set_off_target_read_count(&mut self, off_target_read_count: usize)
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).
Sourcepub fn on_target_read_count(&self) -> usize
pub fn on_target_read_count(&self) -> usize
Get the count of reads that are mapped to the target regions (on-target reads).
Sourcepub fn set_on_target_read_count(&mut self, on_target_read_count: usize)
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).
Sourcepub fn off_target_percent(&self) -> f64
pub fn off_target_percent(&self) -> f64
Get the percentage of off-target reads in the sequencing data.
Sourcepub fn set_off_target_percent(&mut self, off_target_percent: f64)
pub fn set_off_target_percent(&mut self, off_target_percent: f64)
Set the percentage of off-target reads in the sequencing data.
Sourcepub fn off_target_yield(&self) -> usize
pub fn off_target_yield(&self) -> usize
Get the total yield (base pairs) of off-target reads in the sequencing data.
Sourcepub fn set_off_target_yield(&mut self, off_target_yield: usize)
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.
Sourcepub fn on_target_yield(&self) -> usize
pub fn on_target_yield(&self) -> usize
Get the total yield (base pairs) of on-target reads in the sequencing data.
Sourcepub fn set_on_target_yield(&mut self, on_target_yield: usize)
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.
Sourcepub fn mean_read_length(&self) -> usize
pub fn mean_read_length(&self) -> usize
Get the mean read length of all reads
Sourcepub fn off_target_mean_read_length(&self) -> usize
pub fn off_target_mean_read_length(&self) -> usize
Get the mean read length of off-target reads.
Sourcepub fn on_target_mean_read_length(&self) -> usize
pub fn on_target_mean_read_length(&self) -> usize
Get the mean read length of on-target reads.
Sourcepub fn off_target_mean_read_quality(&self) -> f64
pub fn off_target_mean_read_quality(&self) -> f64
Get the mean read quality of off-target reads.
Sourcepub fn set_off_target_mean_read_quality(
&mut self,
off_target_mean_read_quality: f64,
)
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.
Sourcepub fn on_target_mean_read_quality(&self) -> f64
pub fn on_target_mean_read_quality(&self) -> f64
Get the mean read quality of on-target reads.
Sourcepub fn set_on_target_mean_read_quality(
&mut self,
on_target_mean_read_quality: f64,
)
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.
Sourcepub fn on_target_n50(&self) -> usize
pub fn on_target_n50(&self) -> usize
Get the N50 metric for on-target reads.
Sourcepub fn set_on_target_n50(&mut self, on_target_n50: usize)
pub fn set_on_target_n50(&mut self, on_target_n50: usize)
Set the N50 metric for on-target reads.
Sourcepub fn off_target_n50(&self) -> usize
pub fn off_target_n50(&self) -> usize
Get the N50 metric for off-target reads.
Sourcepub fn set_off_target_n50(&mut self, off_target_n50: usize)
pub fn set_off_target_n50(&mut self, off_target_n50: usize)
Set the N50 metric for off-target reads.
Sourcepub fn contigs(&self) -> &HashMap<String, ContigSummary>
pub fn contigs(&self) -> &HashMap<String, ContigSummary>
Get a reference to the vector of ContigSummary
.
Sourcepub fn contigs_mut(&mut self) -> &mut HashMap<String, ContigSummary>
pub fn contigs_mut(&mut self) -> &mut HashMap<String, ContigSummary>
Get a mutable reference to the vector of ContigSummary
.
Sourcepub fn get_or_add_contig(
&mut self,
contig: &str,
length: usize,
) -> &mut ContigSummary
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);
Sourcepub fn total_yield(&self) -> usize
pub fn total_yield(&self) -> usize
get the total yield
Trait Implementations§
Source§impl Debug for ConditionSummary
impl Debug for ConditionSummary
Auto Trait Implementations§
impl Freeze for ConditionSummary
impl RefUnwindSafe for ConditionSummary
impl Send for ConditionSummary
impl Sync for ConditionSummary
impl Unpin for ConditionSummary
impl UnwindSafe for ConditionSummary
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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