Skip to content

Commit

Permalink
fix minor logic issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wjwei-handsome committed Oct 22, 2024
1 parent 8117d28 commit 741e4a7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions precellar/src/barcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,23 +243,24 @@ impl Whitelist {
}

pub fn mean_base_quality_score(&self) -> f64 {
if self.total_base_count <= 0 {
if self.total_base_count == 0 {
// u64 never < 0
0.0
} else {
self.base_qual_sum as f64 / self.total_base_count as f64
}
}

pub fn frac_q30_bases(&self) -> f64 {
if self.total_base_count <= 0 {
if self.total_base_count == 0 {
0.0
} else {
self.q30_base_count as f64 / self.total_base_count as f64
}
}

pub fn frac_exact_match(&self) -> f64 {
if self.total_count <= 0 {
if self.total_count == 0 {
0.0
} else {
1.0 - (self.mismatch_count as f64 / self.total_count as f64)
Expand Down

0 comments on commit 741e4a7

Please sign in to comment.