src/utils/wigToBigWig/wigToBigWig.c 1.8
1.8 2009/11/12 23:15:52 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/utils/wigToBigWig/wigToBigWig.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/wigToBigWig/wigToBigWig.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -B -U 1000000 -r1.7 -r1.8
--- src/utils/wigToBigWig/wigToBigWig.c 6 Nov 2009 19:46:54 -0000 1.7
+++ src/utils/wigToBigWig/wigToBigWig.c 12 Nov 2009 23:15:52 -0000 1.8
@@ -1,61 +1,66 @@
/* wigToBigWig - Convert ascii format wig file (in fixedStep, variableStep or bedGraph format)
* to binary big wig format.. */
#include "common.h"
#include "linefile.h"
#include "hash.h"
#include "options.h"
#include "bigWig.h"
#include "bwgInternal.h"
+#include "zlibFace.h"
static char const rcsid[] = "$Id$";
-int blockSize = 256;
-int itemsPerSlot = 1024;
-boolean clipDontDie = FALSE;
+static int blockSize = 256;
+static int itemsPerSlot = 1024;
+static boolean clipDontDie = FALSE;
+static boolean doCompress = FALSE;
void usage()
/* Explain usage and exit. */
{
errAbort(
"wigToBigWig v %d - Convert ascii format wig file (in fixedStep, variableStep\n"
"or bedGraph format) to binary big wig format.\n"
"usage:\n"
" wigToBigWig in.wig chrom.sizes out.bw\n"
"Where in.wig is in one of the ascii wiggle formats, but not including track lines\n"
"and chrom.sizes is two column: <chromosome name> <size in bases>\n"
"and out.bw is the output indexed big wig file.\n"
"options:\n"
" -blockSize=N - Number of items to bundle in r-tree. Default %d\n"
" -itemsPerSlot=N - Number of data points bundled at lowest level. Default %d\n"
" -clip - If set just issue warning messages rather than dying if wig\n"
- " file contains items off end of chromosome."
+ " file contains items off end of chromosome.\n"
+ " -compress - If set use zlib compression."
, bbiCurrentVersion, blockSize, itemsPerSlot
);
}
static struct optionSpec options[] = {
{"blockSize", OPTION_INT},
{"itemsPerSlot", OPTION_INT},
{"clip", OPTION_BOOLEAN},
+ {"compress", OPTION_BOOLEAN},
{NULL, 0},
};
void wigToBigWig(char *inName, char *chromSizes, char *outName)
/* wigToBigWig - Convert ascii format wig file (in fixedStep, variableStep or bedGraph format)
* to binary big wig format.. */
{
-bigWigFileCreate(inName, chromSizes, blockSize, itemsPerSlot, clipDontDie, outName);
+bigWigFileCreate(inName, chromSizes, blockSize, itemsPerSlot, clipDontDie, doCompress, outName);
}
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
blockSize = optionInt("blockSize", blockSize);
itemsPerSlot = optionInt("itemsPerSlot", itemsPerSlot);
clipDontDie = optionExists("clip");
+doCompress = optionExists("compress");
if (argc != 4)
usage();
wigToBigWig(argv[1], argv[2], argv[3]);
return 0;
}