c442d3afa2063b13c887983131439855665a79a0 kent Wed Feb 27 10:39:02 2013 -0800 Moving general purpose routines from bigBedNamedItems to appropriate library. diff --git src/inc/bbiFile.h src/inc/bbiFile.h index 2d31caa..7937255 100644 --- src/inc/bbiFile.h +++ src/inc/bbiFile.h @@ -143,30 +143,38 @@ struct bbiChromInfo *bbiChromList(struct bbiFile *bbi); /* Return all chromosomes in file. Dispose of this with bbiChromInfoFreeList. */ void bbiChromInfoFreeList(struct bbiChromInfo **pList); /* Free a list of bbiChromInfo's */ bits32 bbiChromSize(struct bbiFile *bbi, char *chrom); /* Returns size of given chromosome. */ void bbiChromInfoKey(const void *va, char *keyBuf); /* Get key field out of bbiChromInfo. */ void *bbiChromInfoVal(const void *va); /* Get val field out of bbiChromInfo. */ +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. */ + struct bbiChromUsage /* Information on how many items per chromosome etc. Used by multipass bbiFile writers. */ { struct bbiChromUsage *next; char *name; /* chromosome name. */ bits32 itemCount; /* Number of items for this chromosome. */ bits32 id; /* Unique ID for chromosome. */ bits32 size; /* Size of chromosome. */ }; enum bbiSummaryType /* Way to summarize data. */ { bbiSumMean = 0, /* Average value */