cb217f20b4a701edfa88f4db623266a9bf25202e
kent
  Mon Mar 4 22:58:07 2013 -0800
Some more steps towards supporting multiple extra indexes in bigBed files.
diff --git src/utils/bigBedInfo/bigBedInfo.c src/utils/bigBedInfo/bigBedInfo.c
index fccd308..102e1e9 100644
--- src/utils/bigBedInfo/bigBedInfo.c
+++ src/utils/bigBedInfo/bigBedInfo.c
@@ -8,59 +8,68 @@
 #include "bigBed.h"
 #include "obscure.h"
 #include "hmmstats.h"
 
 
 void usage()
 /* Explain usage and exit. */
 {
 errAbort(
   "bigBedInfo - Show information about a bigBed file.\n"
   "usage:\n"
   "   bigBedInfo file.bb\n"
   "options:\n"
   "   -udcDir=/dir/to/cache - place to put cache for remote bigBed/bigWigs\n"
   "   -chroms - list all chromosomes and their sizes\n"
-  "   -zooms - list all zoom levels and theier sizes\n"
+  "   -zooms - list all zoom levels and their sizes\n"
   "   -as - get autoSql spec\n"
+  "   -extraIndex - list all the extra indexes\n"
   );
 }
 
 static struct optionSpec options[] = {
    {"udcDir", OPTION_STRING},
    {"chroms", OPTION_BOOLEAN},
    {"zooms", OPTION_BOOLEAN},
    {"as", OPTION_BOOLEAN},
+   {"extraIndex", OPTION_BOOLEAN},
    {NULL, 0},
 };
 
 void printLabelAndLongNumber(char *label, long long l)
 /* Print label: 1,234,567 format number */
 {
 printf("%s: ", label);
 printLongWithCommas(stdout, l);
 printf("\n");
 }
 
 void bigBedInfo(char *fileName)
 /* bigBedInfo - Show information about a bigBed file.. */
 {
 struct bbiFile *bbi = bigBedFileOpen(fileName);
 printf("version: %d\n", bbi->version);
+printf("hasHeaderExtension: %s\n", (bbi->extensionOffset != 0 ? "yes" : "no"));
 printf("isCompressed: %s\n", (bbi->uncompressBufSize > 0 ? "yes" : "no"));
 printf("isSwapped: %d\n", bbi->isSwapped);
-printf("hasNameIndex: %s\n", (bbi->nameIndexOffset != 0 ? "yes" : "no"));
+printf("extraIndexCount: %d\n", bbi->extraIndexCount);
+if (optionExists("extraIndex"))
+    {
+    struct slName *el, *list = bigBedListExtraIndexes(bbi);
+    for (el = list; el != NULL; el = el->next)
+        printf("    %s\n", el->name);
+    }
 printLabelAndLongNumber("itemCount", bigBedItemCount(bbi));
 printLabelAndLongNumber("primaryDataSize", bbi->unzoomedIndexOffset - bbi->unzoomedDataOffset);
 if (bbi->levelList != NULL)
     {
     long long indexEnd = bbi->levelList->dataOffset;
     printLabelAndLongNumber("primaryIndexSize", indexEnd - bbi->unzoomedIndexOffset);
     }
 struct bbiChromInfo *chrom, *chromList = bbiChromList(bbi);
 printf("zoomLevels: %d\n", bbi->zoomLevels);
 if (optionExists("zooms"))
     {
     struct bbiZoomLevel *zoom;
     for (zoom = bbi->levelList; zoom != NULL; zoom = zoom->next)
 	{
 	printf("\t%d\t%d\n", zoom->reductionLevel, (int)(zoom->indexOffset - zoom->dataOffset));