r880: bug in writing .ann file

This commit is contained in:
Heng Li 2014-10-02 15:34:49 -04:00
parent d802cfb7f5
commit 7b62fbb4ba
3 changed files with 11 additions and 24 deletions

View File

@ -226,7 +226,7 @@ static uint8_t *add1(const kseq_t *seq, bntseq_t *bns, uint8_t *pac, int64_t *m_
}
p = bns->anns + bns->n_seqs;
p->name = strdup((char*)seq->name.s);
p->anno = seq->comment.s? strdup((char*)seq->comment.s) : strdup("(null)");
p->anno = seq->comment.l > 0? strdup((char*)seq->comment.s) : strdup("(null)");
p->gi = 0; p->len = seq->seq.l;
p->offset = (bns->n_seqs == 0)? 0 : (p-1)->offset + (p-1)->len;
p->n_ambs = 0;

View File

@ -289,30 +289,9 @@ function bwa_postalt(args)
if (buf2.length && (buf2[0][0] != t[0] || (buf2[0][1]&0xc0) != (t[1]&0xc0))) {
for (var i = 0; i < buf2.length; ++i)
print(buf2[i].join("\t"));
buf2 = [];
buf2 = []; buf3 = [];
}
// test primary and if so whether it overlaps with ALT regions
if (idx_pri[t[2]] != null) {
var start = t[3], end = start;
while ((m = re_cigar.exec(t[5])) != null)
if (m[2] == 'M' || m[2] == 'D' || m[2] == 'N')
end += parseInt(m[1]);
var ovlp = idx_pri[t[2]](start, end);
if (ovlp.length > 0) {
var score = (m = /\tAS:i:(\d+)/.exec(line)) != null? parseInt(m[1]) : 1;
for (var i = 0; i < ovlp.length; ++i)
buf3.push([t[2], start, end, ovlp[i][2]]);
}
}
// parse the XA tag
if ((m = /\tXA:Z:(\S+)/.exec(line)) == null) {
buf2.push(t);
continue;
}
var XA_strs = m[1].split(";");
// parse the reported hit
var hits = [];
var NM = (m = /\tNM:i:(\d+)/.exec(line)) == null? '0' : m[1];
@ -322,6 +301,13 @@ function bwa_postalt(args)
buf2.push(t);
continue;
}
// parse the XA tag
if ((m = /\tXA:Z:(\S+)/.exec(line)) == null) {
buf2.push(t);
continue;
}
var XA_strs = m[1].split(";");
hits.push(h);
// parse hits in the XA tag
@ -356,6 +342,7 @@ function bwa_postalt(args)
}
if (i == 0 && n_rpt_lifted == 1) rpt_lifted = lifted[0].slice(0);
if (lifted.length) ++n_lifted, hits[i].lifted = lifted;
buf3.push(hits[i]);
}
if (n_lifted == 0) {
buf2.push(t);

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h"
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.7.10-r878-dirty"
#define PACKAGE_VERSION "0.7.10-r880-dirty"
#endif
int bwa_fa2pac(int argc, char *argv[]);