src/utils/bigBedInfo/bigBedInfo.c 1.2
1.2 2009/11/13 19:02:38 kent
Adding compression to bigBed. Improving bigWigInfo and bigBedInfo a little.
Index: src/utils/bigBedInfo/bigBedInfo.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/bigBedInfo/bigBedInfo.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 4 -r1.1 -r1.2
--- src/utils/bigBedInfo/bigBedInfo.c 5 Nov 2009 19:57:31 -0000 1.1
+++ src/utils/bigBedInfo/bigBedInfo.c 13 Nov 2009 19:02:38 -0000 1.2
@@ -5,8 +5,9 @@
#include "options.h"
#include "udc.h"
#include "bbiFile.h"
#include "bigBed.h"
+#include "obscure.h"
#include "hmmstats.h"
static char const rcsid[] = "$Id$";
@@ -19,30 +20,50 @@
" 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"
" -as - get autoSql spec\n"
);
}
static struct optionSpec options[] = {
{"udcDir", OPTION_STRING},
{"chroms", OPTION_BOOLEAN},
+ {"zooms", OPTION_BOOLEAN},
{"as", 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("isCompressed: %s\n", (bbi->uncompressBufSize > 0 ? "yes" : "no"));
printf("isSwapped: %d\n", bbi->isSwapped);
-printf("itemCount: %lld\n", bigBedItemCount(bbi));
+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);
+ }
printf("zoomLevels: %d\n", bbi->zoomLevels);
-struct bbiZoomLevel *zoom;
-for (zoom = bbi->levelList; zoom != NULL; zoom = zoom->next)
- printf("\t%d\n", zoom->reductionLevel);
+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));
+ }
struct bbiChromInfo *chrom, *chromList = bbiChromList(bbi);
printf("chromCount: %d\n", slCount(chromList));
if (optionExists("chroms"))
for (chrom=chromList; chrom != NULL; chrom = chrom->next)
@@ -58,9 +79,9 @@
printf("%s", asText);
}
}
struct bbiSummaryElement sum = bbiTotalSummary(bbi);
-printf("basesCovered: %lld\n", sum.validCount);
+printLabelAndLongNumber("basesCovered", sum.validCount);
printf("meanDepth (of bases covered): %f\n", sum.sumData/sum.validCount);
printf("minDepth: %f\n", sum.minVal);
printf("maxDepth: %f\n", sum.maxVal);
printf("std of depth: %f\n", calcStdFromSums(sum.sumData, sum.sumSquares, sum.validCount));