X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bam_rmdupse.c;h=df03717232b10f9e23abe8ae0e7eefbc5a6c7d02;hb=f6a84f5598383371a6cd5b3f82be3f8c3419aa6a;hp=272fa993eba93a929330b4528a435c3eb6ef8050;hpb=42c0abe60c03be85634a84459bdf9fe0b45da977;p=samtools.git diff --git a/bam_rmdupse.c b/bam_rmdupse.c index 272fa99..df03717 100644 --- a/bam_rmdupse.c +++ b/bam_rmdupse.c @@ -63,12 +63,13 @@ static int fill_buf(samfile_t *in, buffer_t *buf) for (i = 0; i < c->l_qseq; ++i) e->score += qual[i] + 1; e->score = (double)e->score / sqrt(c->l_qseq + 1); is_mapped = (c->tid < 0 || c->tid >= in->header->n_targets || (c->flag&BAM_FUNMAP))? 0 : 1; + if (!is_mapped) e->score = -1; if (is_mapped && (c->flag & BAM_FREVERSE)) { e->rpos = b->core.pos + bam_calend(&b->core, bam1_cigar(b)); if (min_rpos > e->rpos) min_rpos = e->rpos; } if (buf->n >= capacity) { - if (c->pos <= min_rpos) capacity += BLOCK_SIZE; + if (is_mapped && c->pos <= min_rpos) capacity += BLOCK_SIZE; else break; } }