Skip to content

Commit

Permalink
avoid duplicated XA tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Heng Li committed Nov 19, 2011
1 parent 8f89f55 commit dc40089
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
7 changes: 5 additions & 2 deletions bwape.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,16 +395,19 @@ int bwa_cal_pac_pos_pe(const bntseq_t *bns, const char *prefix, bwt_t *const _bw
if (opt->N_multi || opt->n_multi) {
for (j = 0; j < 2; ++j) {
if (p[j]->type != BWA_TYPE_NO_MATCH) {
int k;
int k, n_multi;
if (!(p[j]->extra_flag&SAM_FPP) && p[1-j]->type != BWA_TYPE_NO_MATCH) {
bwa_aln2seq_core(d->aln[j].n, d->aln[j].a, p[j], 0, p[j]->c1+p[j]->c2-1 > opt->N_multi? opt->n_multi : opt->N_multi);
} else bwa_aln2seq_core(d->aln[j].n, d->aln[j].a, p[j], 0, opt->n_multi);
for (k = 0; k < p[j]->n_multi; ++k) {
for (k = 0, n_multi = 0; k < p[j]->n_multi; ++k) {
int strand;
bwt_multi1_t *q = p[j]->multi + k;
q->pos = bwa_sa2pos(bns, bwt, q->pos, p[j]->len, &strand);
q->strand = strand;
if (q->pos != p[j]->pos)
p[j]->multi[n_multi++] = *q;
}
p[j]->n_multi = n_multi;
}
}
}
Expand Down
22 changes: 10 additions & 12 deletions bwase.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ void bwa_aln2seq_core(int n_aln, const bwt_aln1_t *aln, bwa_seq_t *s, int set_ma
}
}
s->n_multi = z;
/*// the following code removes the primary hit, but this leads to a bug in the PE mode
for (k = z = 0; k < s->n_multi; ++k)
if (s->multi[k].pos != s->sa)
s->multi[z++] = s->multi[k];
s->n_multi = z < n_multi? z : n_multi;
*/
}
}

Expand Down Expand Up @@ -141,19 +135,23 @@ void bwa_cal_pac_pos_core(const bntseq_t *bns, const bwt_t *bwt, bwa_seq_t *seq,

void bwa_cal_pac_pos(const bntseq_t *bns, const char *prefix, int n_seqs, bwa_seq_t *seqs, int max_mm, float fnr)
{
int i, j, strand;
int i, j, strand, n_multi;
char str[1024];
bwt_t *bwt;
// load forward SA
strcpy(str, prefix); strcat(str, ".bwt"); bwt = bwt_restore_bwt(str);
strcpy(str, prefix); strcat(str, ".sa"); bwt_restore_sa(str, bwt);
for (i = 0; i != n_seqs; ++i) {
bwa_cal_pac_pos_core(bns, bwt, &seqs[i], max_mm, fnr);
for (j = 0; j < seqs[i].n_multi; ++j) {
bwt_multi1_t *p = seqs[i].multi + j;
p->pos = bwa_sa2pos(bns, bwt, p->pos, seqs[i].len, &strand);
p->strand = strand;
bwa_seq_t *p = &seqs[i];
bwa_cal_pac_pos_core(bns, bwt, p, max_mm, fnr);
for (j = n_multi = 0; j < p->n_multi; ++j) {
bwt_multi1_t *q = p->multi + j;
q->pos = bwa_sa2pos(bns, bwt, q->pos, p->len, &strand);
q->strand = strand;
if (q->pos != p->pos)
p->multi[n_multi++] = *q;
}
p->n_multi = n_multi;
}
bwt_destroy(bwt);
}
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "utils.h"

#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.6.0-r89-dev"
#define PACKAGE_VERSION "0.6.0-r90-dev"
#endif

static int usage()
Expand Down

0 comments on commit dc40089

Please sign in to comment.