X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=tabix.git;a=blobdiff_plain;f=index.c;h=704b037d2add76bf0c9d02624c3f449ac2bd314b;hp=80b863d3f84d53ea4c8eafb612db56150c94870a;hb=0a3bf89715283e4d322d28ba4147e987e3477ee3;hpb=e6ba78ac1e0c41c4256dd385895352236d80426a diff --git a/index.c b/index.c index 80b863d..704b037 100644 --- a/index.c +++ b/index.c @@ -158,7 +158,7 @@ static int get_intv(ti_index_t *idx, kstring_t *str, ti_intv_t *intv) intv->tid = get_tid(idx, str->s + b); if (i != str->l) str->s[i] = '\t'; } else if (id == idx->conf.bc) { - // here ->beg is 1-based. it will be changed to 0-based at the end of this routine. + // here ->beg is 0-based. intv->beg = intv->end = strtol(str->s + b, &s, 0); if (!(idx->conf.preset&TI_FLAG_UCSC)) --intv->beg; } else { @@ -174,7 +174,7 @@ static int get_intv(ti_index_t *idx, kstring_t *str, ti_intv_t *intv) if (op == 'M' || op == 'D' || op == 'N') l += x; s = t + 1; } - intv->end = intv->beg + l - 1; + intv->end = intv->beg + l; } } else if ((idx->conf.preset&0xffff) == TI_PRESET_VCF) { // FIXME: the following is NOT tested and is likely to be buggy @@ -188,7 +188,7 @@ static int get_intv(ti_index_t *idx, kstring_t *str, ti_intv_t *intv) s = t + 1; } else ++s; } - intv->end = intv->beg + max - 1; + intv->end = intv->beg + max; } } } @@ -197,7 +197,7 @@ static int get_intv(ti_index_t *idx, kstring_t *str, ti_intv_t *intv) } } if (intv->tid < 0 || intv->beg < 0 || intv->end < 0) return -1; - intv->bin = ti_reg2bin(intv->beg-1, intv->end); + intv->bin = ti_reg2bin(intv->beg, intv->end); return 0; }