diff --git a/bwtsw2_aux.c b/bwtsw2_aux.c index 8f25734..5637b70 100644 --- a/bwtsw2_aux.c +++ b/bwtsw2_aux.c @@ -428,6 +428,7 @@ static void print_hits(const bntseq_t *bns, const bsw2opt_t *opt, bsw2seq1_t *ks if (p->n_seeds < 2) c *= .2; qual = (int)(c * (p->G - subo) * (250.0 / p->G + 0.03 / opt->a) + .499); if (qual > 250) qual = 250; + if (qual < 0) qual = 0; if (p->flag&1) qual = 0; } ksprintf(&str, "\t%d\t", qual); diff --git a/bwtsw2_core.c b/bwtsw2_core.c index f7b72de..cc3dc63 100644 --- a/bwtsw2_core.c +++ b/bwtsw2_core.c @@ -35,7 +35,7 @@ typedef struct { #include "ksort.h" KSORT_INIT_GENERIC(int) -#define __hitG_lt(a, b) ((a).n_seeds > (b).n_seeds || ((a).n_seeds == (b).n_seeds && (a).G > (b).G)) +#define __hitG_lt(a, b) (((a).G + ((int)(a).n_seeds<<2)) > (b).G + ((int)(b).n_seeds<<2)) KSORT_INIT(hitG, bsw2hit_t, __hitG_lt) static const bsw2cell_t g_default_cell = { 0, 0, MINUS_INF, MINUS_INF, MINUS_INF, 0, 0, 0, -1, -1, {-1, -1, -1, -1} };