src/utils/bedToBigBed/bedToBigBed.c 1.12
1.12 2009/11/05 19:35:01 kent
Bumping version number. Making sectionCount and zoomCount more consistent.
Index: src/utils/bedToBigBed/bedToBigBed.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/bedToBigBed/bedToBigBed.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -b -B -U 4 -r1.11 -r1.12
--- src/utils/bedToBigBed/bedToBigBed.c 28 Sep 2009 18:20:28 -0000 1.11
+++ src/utils/bedToBigBed/bedToBigBed.c 5 Nov 2009 19:35:01 -0000 1.12
@@ -248,10 +248,10 @@
}
return tree;
}
-struct bbiSummary *writeReducedOnceReturnReducedTwice(struct bbiChromUsage *usageList,
- int fieldCount, struct lineFile *lf, int initialReduction, int initialReductionCount,
+static struct bbiSummary *writeReducedOnceReturnReducedTwice(struct bbiChromUsage *usageList,
+ int fieldCount, struct lineFile *lf, bits32 initialReduction, bits32 initialReductionCount,
int zoomIncrement, int blockSize, int itemsPerSlot,
struct lm *lm, FILE *f, bits64 *retDataStart, bits64 *retIndexStart)
/* Write out data reduced by factor of initialReduction. Also calculate and keep in memory
* next reduction level. This is more work than some ways, but it keeps us from having to
@@ -264,8 +264,9 @@
boundsPt = AllocArray(boundsArray, initialReductionCount);
boundsEnd = boundsPt + initialReductionCount;
*retDataStart = ftell(f);
+writeOne(f, initialReductionCount);
/* This gets a little complicated I'm afraid. The strategy is to:
* 1) Build up a range tree that represents coverage depth on that chromosome
* This also has the nice side effect of getting rid of overlaps.
@@ -385,9 +386,10 @@
/* Do first pass, mostly just scanning file and counting hits per chromosome. */
int minDiff = 0;
double aveSpan = 0;
-struct bbiChromUsage *usageList = bbiChromUsageFromBedFile(lf, chromSizesHash, &minDiff, &aveSpan);
+bits64 bedCount = 0;
+struct bbiChromUsage *usageList = bbiChromUsageFromBedFile(lf, chromSizesHash, &minDiff, &aveSpan, &bedCount);
verboseTime(1, "pass1 - making usageList");
verbose(2, "%d chroms in %s. Average span of beds %f\n", slCount(usageList), inName, aveSpan);
/* Open output file and write dummy header. */
@@ -428,8 +430,9 @@
}
/* Write out primary full resolution data in sections, collect stats to use for reductions. */
bits64 dataOffset = ftell(f);
+writeOne(f, bedCount);
bits32 blockCount = bbiCountSectionsNeeded(usageList, itemsPerSlot);
struct bbiBoundsArray *boundsArray;
AllocArray(boundsArray, blockCount);
lineFileRewind(lf);
@@ -509,9 +512,9 @@
}
/* Go back and rewrite header. */
rewind(f);
bits32 sig = bigBedSig;
-bits16 version = 1;
+bits16 version = bbiCurrentVersion;
bits16 summaryCount = zoomLevels;
bits32 reserved32 = 0;
bits32 reserved64 = 0;