src/inc/bbiFile.h 1.18

1.18 2009/11/12 23:15:51 kent
First cut of compressed bigWig/bigBed stuff. So far read side should be complete including Genome Browser, Table Browser, wigToBigWig and bigWig utility functions. Still to do bedGraphToBigWig and bedToBigBed.
Index: src/inc/bbiFile.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/inc/bbiFile.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -b -B -U 4 -r1.17 -r1.18
--- src/inc/bbiFile.h	7 Nov 2009 17:38:19 -0000	1.17
+++ src/inc/bbiFile.h	12 Nov 2009 23:15:51 -0000	1.18
@@ -16,9 +16,10 @@
  *         fieldCount           2 bytes (for bigWig 0)
  *         definedFieldCount    2 bytes (for bigWig 0)
  *         autoSqlOffset        8 bytes (for bigWig 0) (0 if no autoSql information)
  *         totalSummaryOffset   8 bytes (0 in earlier versions of file lacking totalSummary)
- *         reserved            12 bytes (0 for now)
+ *         uncompressBufSize    4 bytes (Size of uncompression buffer.  0 if uncompressed.)
+ *         reserved             8 bytes (0 for now)
  *     zoomHeaders		there are zoomLevels number of these
  *         reductionLevel	4 bytes
  *	   reserved		4 bytes
  *	   dataOffset		8 bytes
@@ -53,17 +54,19 @@
 #ifndef CIRTREE_H
 #include "cirTree.h"
 #endif
 
-#define bbiCurrentVersion 2
+#define bbiCurrentVersion 3
 /* Version history (of file format, not utilities - corresponds to version field in header)
  *    1 - Initial release
  *    1 - Unfortunately when attempting a transparent change to encoders, made the sectionCount 
  *        field inconsistent, sometimes not present, sometimes 32 bits.  Since offset positions
  *        in index were still accurate this did not break most applications, but it did show
  *        up in the summary section of the Table Browser.
  *    2 - Made sectionCount consistently 64 bits. Also fixed missing zoomCount in first level of
  *        zoom in files made by bedToBigBed and bedGraphToBigWig.  (The older wigToBigWig was fine.)
+ *        Added totalSummary section.
+ *    3 - Adding zlib compression.  Only active if uncompressBufSize is non-zero in header.
  */
 
 struct bbiZoomLevel
 /* A zoom level in bigWig file. */
@@ -96,8 +99,9 @@
     bits16 fieldCount;		/* Number of columns in bed version. */
     bits16 definedFieldCount;   /* Number of columns using bed standard definitions. */
     bits64 asOffset;		/* Offset to embedded null-terminated AutoSQL file. */
     bits64 totalSummaryOffset;	/* Offset to total summary information if any.  (On older files have to calculate) */
+    bits32 uncompressBufSize;	/* Size of uncompression buffer, 0 if uncompressed */
     struct cirTreeFile *unzoomedCir;	/* Unzoomed data index in memory - may be NULL. */
     struct bbiZoomLevel *levelList;	/* List of zoom levels. */
     };
 
@@ -319,9 +323,9 @@
 	struct bbiChromInfo *chromInfoArray, int reduction);
 /* Reduce summary list to another summary list. */
 
 bits64 bbiWriteSummaryAndIndex(struct bbiSummary *summaryList, 
-	int blockSize, int itemsPerSlot, FILE *f);
+	int blockSize, int itemsPerSlot, boolean doCompress, FILE *f);
 /* Write out summary and index to summary, returning start position of
  * summary index. */
 
 #endif /* BBIFILE_H */