diff --git a/src/align.c b/src/align.c index ad9535a..0c5716c 100644 --- a/src/align.c +++ b/src/align.c @@ -38,8 +38,8 @@ static inline void update_max_zdrop(int32_t score, int i, int j, int32_t *max, i int z = *max - score - diff * e; if (z > *max_zdrop) { *max_zdrop = z; - pos[0][0] = *max_i, pos[0][1] = i + 1; - pos[1][0] = *max_j, pos[1][1] = j + 1; + pos[0][0] = *max_i, pos[0][1] = i; + pos[1][0] = *max_j, pos[1][1] = j; } } else *max = score, *max_i = i, *max_j = j; } diff --git a/src/esterr.c b/src/esterr.c index 733c762..7a509da 100644 --- a/src/esterr.c +++ b/src/esterr.c @@ -59,6 +59,6 @@ void mm_est_err(const mm_idx_t *mi, int qlen, int n_regs, mm_reg1_t *regs, const n_tot = en - st + 1; if (r->qs > avg_k && r->rs > avg_k) ++n_tot; if (qlen - r->qs > avg_k && l_ref - r->re > avg_k) ++n_tot; - r->div = logf((float)n_tot / n_match) / avg_k; + r->div = n_match >= n_tot? 0.0f : (float)(1.0 - pow((double)n_match / n_tot, 1.0 / avg_k)); } } diff --git a/src/format.c b/src/format.c index 29279f3..6508996 100644 --- a/src/format.c +++ b/src/format.c @@ -392,7 +392,7 @@ void mm_write_sam3(kstring_t *s, const mm_idx_t *mi, const mm_bseq1_t *t, int se { const int max_bam_cigar_op = 65535; int flag, n_regs = n_regss[seg_idx], cigar_in_tag = 0; - int this_rid = -1, this_pos = -1, this_rev = 0; + int this_rid = -1, this_pos = -1; const mm_reg1_t *regs = regss[seg_idx], *r_prev = NULL, *r_next; const mm_reg1_t *r = n_regs > 0 && reg_idx < n_regs && reg_idx >= 0? ®s[reg_idx] : NULL; @@ -441,7 +441,7 @@ void mm_write_sam3(kstring_t *s, const mm_idx_t *mi, const mm_bseq1_t *t, int se mm_sprintf_lite(s, "\t%s\t%d\t0\t*", mi->seq[this_rid].name, this_pos+1); } else mm_sprintf_lite(s, "\t*\t0\t0\t*"); } else { - this_rid = r->rid, this_pos = r->rs, this_rev = r->rev; + this_rid = r->rid, this_pos = r->rs; mm_sprintf_lite(s, "\t%s\t%d\t%d\t", mi->seq[r->rid].name, r->rs+1, r->mapq); if ((opt_flag & MM_F_LONG_CIGAR) && r->p && r->p->n_cigar > max_bam_cigar_op - 2) { int n_cigar = r->p->n_cigar; diff --git a/src/index.c b/src/index.c index 9740c2e..8f40873 100644 --- a/src/index.c +++ b/src/index.c @@ -704,7 +704,7 @@ mm_idx_intv_t *mm_idx_read_bed(const mm_idx_t *mi, const char *fn, int read_junc char *p, *q, *bl, *bs; int32_t i, id = -1, n_blk = 0; for (p = q = str.s, i = 0;; ++p) { - if (*p == 0 || isspace(*p)) { + if (*p == 0 || *p == '\t') { int32_t c = *p; *p = 0; if (i == 0) { // chr