From 741e4a73e54f0dffb33cdcf73be5e8fcfeca8811 Mon Sep 17 00:00:00 2001 From: wenjiewei Date: Tue, 22 Oct 2024 14:56:14 +0800 Subject: [PATCH] fix minor logic issue --- precellar/src/barcode.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/precellar/src/barcode.rs b/precellar/src/barcode.rs index d0528ec..aac326f 100644 --- a/precellar/src/barcode.rs +++ b/precellar/src/barcode.rs @@ -243,7 +243,8 @@ 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 @@ -251,7 +252,7 @@ impl Whitelist { } 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 @@ -259,7 +260,7 @@ impl Whitelist { } 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)