From 323293fbda7204bb510f3599929cab17f133858b Mon Sep 17 00:00:00 2001 From: Heng Li Date: Wed, 26 Jul 2017 14:20:31 -0400 Subject: [PATCH] changed the way mapq is counted --- misc/pbsim-eval.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/misc/pbsim-eval.js b/misc/pbsim-eval.js index 12a5e6b..0e45429 100644 --- a/misc/pbsim-eval.js +++ b/misc/pbsim-eval.js @@ -72,20 +72,17 @@ function count_err(qname, a, tot, err, mode) s[2] = parseInt(s[2]); s[3] = parseInt(s[3]); s.shift(); // skip pbsim orginal read name - var max_mapq = 0; - for (var i = 0; i < a.length; ++i) - if (a[i][4] > max_mapq) - max_mapq = a[i][4]; - ++tot[max_mapq]; if (mode == 0) { // longest only var max = 0, max_i = -1; for (var i = 0; i < a.length; ++i) if (a[i][2] - a[i][1] > max) max = a[i][2] - a[i][1], max_i = i; + var mapq = a[max_i][4]; + ++tot[mapq]; if (!is_correct(s, a[max_i])) { - if (max_mapq >= err_out_q) + if (mapq >= err_out_q) print('E', qname, a[max_i].join("\t")); - ++err[max_mapq]; + ++err[mapq]; } } }