e3be90f04ee596b030b225aa98301abba9bace1e angie Wed Mar 28 15:41:59 2012 -0700 lineFileTabixMayOpen: initialize lf->tabixIter to ti_iter_first sowe can start reading lines from the beginning of the tabix-indexed file, without having to make an iterator for a specific region. diff --git src/lib/linefile.c src/lib/linefile.c index c2d9a3a..7827e49 100644 --- src/lib/linefile.c +++ src/lib/linefile.c @@ -217,30 +217,31 @@ if ((tabix->idx = ti_index_load(tbiName)) == NULL) { warn("Unable to load tabix index from \"%s\"", tbiName); ti_close(tabix); tabix = NULL; freez(&tbiName); return NULL; } struct lineFile *lf = needMem(sizeof(struct lineFile)); lf->fileName = cloneString(fileOrUrl); lf->fd = -1; lf->bufSize = 64 * 1024; lf->buf = needMem(lf->bufSize); lf->zTerm = zTerm; lf->tabix = tabix; +lf->tabixIter = ti_iter_first(); freez(&tbiName); return lf; #else // no USE_TABIX warn(COMPILE_WITH_TABIX, "lineFileTabixMayOpen"); return NULL; #endif // no USE_TABIX } boolean lineFileSetTabixRegion(struct lineFile *lf, char *seqName, int start, int end) /* Assuming lf was created by lineFileTabixMayOpen, tell tabix to seek to the specified region * and return TRUE (or if there are no items in region, return FALSE). */ { #ifdef USE_TABIX if (lf->tabix == NULL) errAbort("lineFileSetTabixRegion: lf->tabix is NULL. Did you open lf with lineFileTabixMayOpen?");