make output better

This commit is contained in:
Heng Li 2017-07-26 12:03:42 -04:00
parent a01d758af6
commit bd33bed455
1 changed files with 10 additions and 7 deletions

View File

@ -84,7 +84,7 @@ function count_err(qname, a, tot, err, mode)
max = a[i][2] - a[i][1], max_i = i;
if (!is_correct(s, a[max_i])) {
if (max_mapq >= err_out_q)
print(qname, a[max_i].join("\t"));
print('E', qname, a[max_i].join("\t"));
++err[max_mapq];
}
}
@ -114,11 +114,14 @@ if (last != null) count_err(last, a, tot, err, mode);
buf.destroy();
file.close();
if (!print_err) {
var sum_tot = 0, sum_err = 0;
for (var q = max_mapq; q >= 0; --q) {
if (tot[q] == 0) continue;
sum_tot += tot[q], sum_err += err[q];
print(q, tot[q], err[q], sum_tot, sum_err, sum_err/sum_tot);
var sum_tot = 0, sum_err = 0, q_out = -1, sum_tot2 = 0, sum_err2 = 0;
for (var q = max_mapq; q >= 0; --q) {
if (tot[q] == 0) continue;
if (q_out < 0 || err[q] > 0) {
if (q_out >= 0) print('Q', q_out, sum_tot, sum_err, (sum_err2/sum_tot2).toFixed(9));
sum_tot = sum_err = 0, q_out = q;
}
sum_tot += tot[q], sum_err += err[q];
sum_tot2 += tot[q], sum_err2 += err[q];
}
print('Q', q_out, sum_tot, sum_err, (sum_err2/sum_tot2).toFixed(9));