src/utils/bigWigInfo/bigWigInfo.c 1.8

1.8 2010/04/28 22:56:25 braney
add minMax option for the ENCODE validator to use
Index: src/utils/bigWigInfo/bigWigInfo.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/bigWigInfo/bigWigInfo.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -B -U 4 -r1.7 -r1.8
--- src/utils/bigWigInfo/bigWigInfo.c	9 Apr 2010 20:32:34 -0000	1.7
+++ src/utils/bigWigInfo/bigWigInfo.c	28 Apr 2010 22:56:25 -0000	1.8
@@ -22,15 +22,17 @@
   "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 their sizes\n"
+  "   -minMax - list the min and max on a single line\n"
   );
 }
 
 static struct optionSpec options[] = {
    {"udcDir", OPTION_STRING},
    {"chroms", OPTION_BOOLEAN},
    {"zooms", OPTION_BOOLEAN},
+   {"minMax", OPTION_BOOLEAN},
    {NULL, 0},
 };
 
 void printLabelAndLongNumber(char *label, long long l)
@@ -44,8 +46,16 @@
 void bigWigInfo(char *fileName)
 /* bigWigInfo - Print out information about bigWig file.. */
 {
 struct bbiFile *bwf = bigWigFileOpen(fileName);
+
+if (optionExists("minMax"))
+    {
+    struct bbiSummaryElement sum = bbiTotalSummary(bwf);
+    printf("%f %f\n", sum.minVal, sum.maxVal);
+    return;
+    }
+
 printf("version: %d\n", bwf->version);
 printf("isCompressed: %s\n", (bwf->uncompressBufSize > 0 ? "yes" : "no"));
 printf("isSwapped: %d\n", bwf->isSwapped);
 printLabelAndLongNumber("primaryDataSize", bwf->unzoomedIndexOffset - bwf->unzoomedDataOffset);