support paired-end reads

this gives unnecessary warnings, which will be fixed later.
This commit is contained in:
Heng Li 2018-01-07 13:53:26 -05:00
parent 405d531100
commit 7b5a601d48
1 changed files with 6 additions and 2 deletions

View File

@ -93,11 +93,15 @@ function main(args) {
var is_pri = false, cigar = null, a1;
var qname = conv != null? conv.get(t[0]) : null;
if (qname != null) t[0] = qname;
if (t.length >= 10 && t[4] != '+' && t[4] != '-' && /^\d+/.test(t[1])) { // SAM
var flag = parseInt(t[1]);
if (flag&1) t[0] += '/' + (flag>>6&3);
}
if (a.length && a[0][3] != t[0]) {
print_lines(a, fmt);
a = [];
}
if (t.length >= 12 && (t[4] == '+' || t[4] == '-')) {
if (t.length >= 12 && (t[4] == '+' || t[4] == '-')) { // PAF
for (var i = 12; i < t.length; ++i) {
if (t[i].substr(0, 5) == 'cg:Z:') {
cigar = t[i].substr(5);
@ -106,7 +110,7 @@ function main(args) {
}
}
a1 = [t[5], t[7], t[8], t[0], Math.floor(t[9]/t[10]*1000), t[4]];
} else if (t.length >= 10) {
} else if (t.length >= 10) { // SAM
var flag = parseInt(t[1]);
if ((flag&4) || a[2] == '*') continue;
cigar = t[5];