no poor hits with -a; reduce mapq for 2nd primary
This commit is contained in:
parent
4dc982a3c7
commit
514563bd0a
4
bwamem.c
4
bwamem.c
|
|
@ -623,12 +623,16 @@ void mem_sam_se(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, b
|
||||||
kstring_t str;
|
kstring_t str;
|
||||||
str.l = str.m = 0; str.s = 0;
|
str.l = str.m = 0; str.s = 0;
|
||||||
if (a->n > 0) {
|
if (a->n > 0) {
|
||||||
|
int mapq0 = -1;
|
||||||
for (k = 0; k < a->n; ++k) {
|
for (k = 0; k < a->n; ++k) {
|
||||||
bwahit_t h;
|
bwahit_t h;
|
||||||
if (a->a[k].secondary >= 0 && !(opt->flag&MEM_F_ALL)) continue;
|
if (a->a[k].secondary >= 0 && !(opt->flag&MEM_F_ALL)) continue;
|
||||||
|
if (a->a[k].secondary >= 0 && a->a[k].score < a->a[a->a[k].secondary].score * .5) continue;
|
||||||
mem_alnreg2hit(&a->a[k], &h);
|
mem_alnreg2hit(&a->a[k], &h);
|
||||||
h.flag |= extra_flag;
|
h.flag |= extra_flag;
|
||||||
h.qual = a->a[k].secondary >= 0? 0 : mem_approx_mapq_se(opt, &a->a[k]);
|
h.qual = a->a[k].secondary >= 0? 0 : mem_approx_mapq_se(opt, &a->a[k]);
|
||||||
|
if (k == 0) mapq0 = h.qual;
|
||||||
|
else if (h.qual > mapq0) h.qual = mapq0;
|
||||||
bwa_hit2sam(&str, opt->mat, opt->q, opt->r, opt->w, bns, pac, s, &h, opt->flag&MEM_F_HARDCLIP, m);
|
bwa_hit2sam(&str, opt->mat, opt->q, opt->r, opt->w, bns, pac, s, &h, opt->flag&MEM_F_HARDCLIP, m);
|
||||||
}
|
}
|
||||||
} else bwa_hit2sam(&str, opt->mat, opt->q, opt->r, opt->w, bns, pac, s, 0, opt->flag&MEM_F_HARDCLIP, m);
|
} else bwa_hit2sam(&str, opt->mat, opt->q, opt->r, opt->w, bns, pac, s, 0, opt->flag&MEM_F_HARDCLIP, m);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue