fixed a minor issue about +/-1

This commit is contained in:
Heng Li 2011-10-25 13:00:41 -04:00
parent 7168f5c10a
commit 7664795ffb
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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
}

2
main.c
View File

@ -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()