} pair64_t;
#define pair64_lt(a,b) ((a).u < (b).u)
-KSORT_INIT(off, pair64_t, pair64_lt)
+KSORT_INIT(offt, pair64_t, pair64_lt)
typedef struct {
uint32_t m, n;
}
} else if ((idx->conf.preset&0xffff) == TI_PRESET_VCF) {
// FIXME: the following is NOT tested and is likely to be buggy
- if (id == 5) { // ALT
- char *t;
- int max = 1;
- for (s = str->s + b; s < str->s + i;) {
- if (s[i] == 'D') {
- long x = strtol(s + 1, &t, 10);
- if (x > max) max = x;
- s = t + 1;
- } else ++s;
+ if (id == 4) {
+ if (b < i) intv->end = intv->beg + (i - b);
+ } else if (id == 8) { // look for "END="
+ int c = str->s[i];
+ str->s[i] = 0;
+ s = strstr(str->s + b, "END=");
+ if (s == str->s + b) s += 4;
+ else if (s) {
+ s = strstr(str->s + b, ";END=");
+ if (s) s += 5;
}
- intv->end = intv->beg + max;
+ if (s) intv->end = strtol(s, &s, 0);
+ str->s[i] = c;
}
}
}
free(bins);
{
int l;
- ks_introsort(off, n_off, off);
+ ks_introsort(offt, n_off, off);
// resolve completely contained adjacent blocks
for (i = 1, l = 0; i < n_off; ++i)
if (off[l].v < off[i].v)
return ti_iter_query(t->idx, tid, beg, end);
}
+ti_iter_t ti_querys(tabix_t *t, const char *reg)
+{
+ int tid, beg, end;
+ if (reg == 0) return ti_iter_first();
+ if (ti_lazy_index_load(t) != 0) return 0;
+ if (ti_parse_region(t->idx, reg, &tid, &beg, &end) < 0) return 0;
+ return ti_iter_query(t->idx, tid, beg, end);
+}
+
ti_iter_t ti_query(tabix_t *t, const char *name, int beg, int end)
{
int tid;