src/lib/bigBed.c 1.21

1.21 2009/08/27 03:54:39 kent
Checking for zero chromosome coordinate (supposed to be 1-based coordinates)
Index: src/lib/bigBed.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/bigBed.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -b -B -U 4 -r1.20 -r1.21
--- src/lib/bigBed.c	12 Aug 2009 21:36:26 -0000	1.20
+++ src/lib/bigBed.c	27 Aug 2009 03:54:39 -0000	1.21
@@ -22,8 +22,9 @@
 {
 return bbiFileOpen(fileName, bigBedSig, "big bed");
 }
 
+#ifdef OLD
 static int ppBedCmp(const void *va, const void *vb)
 /* Compare to sort based on chrom,start,end. */
 {
 const struct ppBed *a = *((struct ppBed **)va);
@@ -37,9 +38,11 @@
         dif = a->end - b->end;
     }
 return dif;
 }
+#endif /* OLD */
 
+#ifdef OLD
 static struct cirTreeRange ppBedFetchKey(const void *va, void *context)
 /* Fetch ppBed key for r-tree */
 {
 struct cirTreeRange res;
@@ -48,16 +51,20 @@
 res.start = a->start;
 res.end = a->end;
 return res;
 }
+#endif /* OLD */
 
+#ifdef OLD
 static bits64 ppBedFetchOffset(const void *va, void *context)
 /* Fetch ppBed file offset for r-tree */
 {
 const struct ppBed *a = *((struct ppBed **)va);
 return a->fileOffset;
 }
+#endif /* OLD */
 
+#ifdef OLD
 static struct ppBed *ppBedLoadOne(char **row, int fieldCount, struct lineFile *lf, 
 	struct hash *chromHash, boolean clip, struct lm *lm, struct asObject *as, bits64 *diskSize)
 /* Return a ppBed record from a line of bed file in lf.
    Return the disk size it would occupy in *diskSize.
@@ -147,9 +154,11 @@
     *diskSize = 3*sizeof(bits32) + 1;  /* Still will write terminal 0 */
     }
 return pb;
 }
+#endif /* OLD */
 
+#ifdef OLD
 static struct ppBed *ppBedLoadAll(char *fileName, struct hash *chromHash, struct lm *lm, 
 	struct asObject *as, int definedFieldCount, boolean clip,
 	bits64 *retDiskSize, bits16 *retFieldCount, boolean *isSorted, 
 	bits64 *count, double *avgSize)
@@ -217,8 +226,9 @@
 freeMem(row);
 *retFieldCount = fieldCount;
 return pbList;
 }
+#endif /* OLD */
 
 // Not used now, compiler gives a 'unused code' warning if its left in
 // static double ppBedAverageSize(struct ppBed *pbList)
 // /* Return size of average bed in list. */
@@ -233,8 +243,9 @@
 //     }
 // return total/count;
 // }
 
+#ifdef OLD
 static void makeChromInfo(struct ppBed *pbList, struct hash *chromSizeHash,
 	int *retChromCount, struct bbiChromInfo **retChromArray,
 	int *retMaxChromNameSize)
 /* Fill in chromId field in pbList.  Return array of chromosome name/ids. 
@@ -277,9 +288,11 @@
 *retChromCount = chromCount;
 *retChromArray = chromArray;
 *retMaxChromNameSize = maxChromNameSize;
 }
+#endif /* OLD */
 
+#ifdef OLD
 static struct bbiSummary *summaryOnDepth(struct ppBed *pbList, struct bbiChromInfo *chromInfoArray, 
 	int reduction)
 /* Produce a summary based on depth of coverage. */
 {
@@ -310,9 +323,11 @@
     }
 slReverse(&outList);
 return outList;
 }
+#endif /* OLD */
 
+#ifdef OLD
 static void bigBedFileCreateReadInFile(
 	char *inName, 	  /* Input file in a tabular bed format <chrom><start><end> + whatever. */
 	char *chromSizes, /* Two column tab-separated file: <chromosome> <size>. */
 	int blockSize,	  /* Number of items to bundle in r-tree.  1024 is good. */
@@ -353,9 +368,11 @@
 *ppbList = pbList;
 *pChromHash = chromHash;
 *pAs = as;
 }
+#endif /* OLD */
 
+#ifdef OLD
 void bigBedFileCreateDetailed(
 	struct ppBed *pbList, 	  /* Input bed data. Must be sorted. */
 	bits64 pbCount,           /* size of input pbList */
 	double pbAverageSize,     /* average size of elements in pbList */
@@ -567,9 +584,11 @@
 
 carefulClose(&f);
 freez(&chromInfoArray);
 }
+#endif /* OLD */
 
+#ifdef OLD
 void bigBedFileCreate(
 	char *inName, 	  /* Input file in a tabular bed format <chrom><start><end> + whatever. */
 	char *chromSizes, /* Two column tab-separated file: <chromosome> <size>. */
 	int blockSize,	  /* Number of items to bundle in r-tree.  1024 is good. */
@@ -593,8 +612,9 @@
 	&fullSize);
 bigBedFileCreateDetailed(pbList, count, averageSize, inName, chromHash, blockSize, itemsPerSlot, 
     definedFieldCount, fieldCount, asFileName, as, fullSize, outName);
 }
+#endif /* OLD */
 
 struct bigBedInterval *bigBedIntervalQuery(struct bbiFile *bbi, char *chrom, 
 	bits32 start, bits32 end, int maxItems, struct lm *lm)
 /* Get data for interval.  Return list allocated out of lm.  Set maxItems to maximum