Skip to content

Commit e65486b

Browse files
committed
filter.rs: fix bugs in average quality score calculation
1 parent 357552e commit e65486b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/filter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ fn phred_mean(
178178
) -> u8 {
179179
let ave_error = qual
180180
.iter()
181-
.map(|x| { 10.0f64.powf((x -phred) as f64 / 10.0) })
181+
.map(|x| { 10.0f64.powf((x - phred) as f64 / -10.0) })
182182
.sum::<f64>() / qual.len() as f64;
183183

184-
(ave_error.log10() * -10.0f64) as u8 - phred
184+
(-10.0f64 * ave_error.log10()) as u8
185185
}

0 commit comments

Comments
 (0)