From 7664795ffb15a568b2e5e2dffe26f492f4f230e9 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Tue, 25 Oct 2011 13:00:41 -0400 Subject: [PATCH] fixed a minor issue about +/-1 --- bntseq.h | 2 +- bwase.c | 2 +- main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bntseq.h b/bntseq.h index 0becc01..843db64 100644 --- a/bntseq.h +++ b/bntseq.h @@ -79,7 +79,7 @@ extern "C" { static inline int64_t bns_depos(const bntseq_t *bns, int64_t pos, int *is_rev) { - return (*is_rev = (pos >= bns->l_pac))? (bns->l_pac<<1) - pos : pos; + return (*is_rev = (pos >= bns->l_pac))? (bns->l_pac<<1) - 1 - pos : pos; } #endif diff --git a/bwase.c b/bwase.c index 124d6b4..76480d4 100644 --- a/bwase.c +++ b/bwase.c @@ -118,7 +118,7 @@ bwtint_t bwa_sa2pos(const bntseq_t *bns, const bwt_t *bwt, bwtint_t sapos, int l /* NB: For gapped alignment, pacpos may not be correct, which will be fixed * in refine_gapped_core(). This line also determines the way "x" is * calculated in refine_gapped_core() when (ext < 0 && is_end == 0). */ - if (is_rev) pos_f = pos_f < len? 0 : pos_f - len; // mapped to the forward strand + if (is_rev) pos_f = pos_f + 1 < len? 0 : pos_f - len + 1; // mapped to the forward strand return pos_f; // FIXME: it is possible that pos_f < bns->anns[ref_id].offset } diff --git a/main.c b/main.c index eda54f4..bc4eca4 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,7 @@ #include "utils.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.6.0-r63-dev" +#define PACKAGE_VERSION "0.6.0-r64-dev" #endif static int usage()