c442d3afa2063b13c887983131439855665a79a0 kent Wed Feb 27 10:39:02 2013 -0800 Moving general purpose routines from bigBedNamedItems to appropriate library. diff --git src/lib/bbiRead.c src/lib/bbiRead.c index cebaa7d..f8bb53c 100644 --- src/lib/bbiRead.c +++ src/lib/bbiRead.c @@ -749,15 +749,29 @@ res.sumData += udcReadFloat(udc, isSwapped); res.sumSquares += udcReadFloat(udc, isSwapped); } } } } return res; } time_t bbiUpdateTime(struct bbiFile *bbi) /* return bbi->udc->updateTime */ { struct udcFile *udc = bbi->udc; return udcUpdateTime(udc); } + +char *bbiCachedChromLookup(struct bbiFile *bbi, int chromId, int lastChromId, + char *chromBuf, int chromBufSize) +/* Return chromosome name corresponding to chromId. Because this is a bit expensive, + * if you are doing this repeatedly pass in the chromId used in the previous call to + * this in lastChromId, which will save it from doing the lookup again on the same + * chromosome. Pass in -1 to lastChromId if this is the first time or if you can't be + * bothered. The chromBufSize should be at greater or equal to bbi->keySize+1. */ +{ +if (chromId != lastChromId) + bptStringKeyAtPos(bbi->chromBpt, chromId, chromBuf, chromBufSize); +return chromBuf; +} +