src/lib/bwgQuery.c 1.22
1.22 2009/11/10 05:46:05 kent
Making bigWigSummary functions take a bbiFile rather than a fileName.
Index: src/lib/bwgQuery.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/bwgQuery.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -b -B -U 4 -r1.21 -r1.22
--- src/lib/bwgQuery.c 10 Mar 2009 01:14:53 -0000 1.21
+++ src/lib/bwgQuery.c 10 Nov 2009 05:46:05 -0000 1.22
@@ -290,40 +290,36 @@
slFreeList(&blockList);
return printCount;
}
-boolean bigWigSummaryArray(char *fileName, char *chrom, bits32 start, bits32 end,
+boolean bigWigSummaryArray(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end,
enum bbiSummaryType summaryType, int summarySize, double *summaryValues)
/* Fill in summaryValues with data from indicated chromosome range in bigWig file.
* Be sure to initialize summaryValues to a default value, which will not be touched
* for regions without data in file. (Generally you want the default value to either
* be 0.0 or nan("") depending on the application.) Returns FALSE if no data
* at that position. */
{
-struct bbiFile *bwf = bigWigFileOpen(fileName);
boolean ret = bbiSummaryArray(bwf, chrom, start, end, bigWigIntervalQuery,
summaryType, summarySize, summaryValues);
-bbiFileClose(&bwf);
return ret;
}
-boolean bigWigSummaryArrayExtended(char *fileName, char *chrom, bits32 start, bits32 end,
+boolean bigWigSummaryArrayExtended(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end,
int summarySize, struct bbiSummaryElement *summary)
/* Get extended summary information for summarySize evenely spaced elements into
* the summary array. */
{
-struct bbiFile *bbi = bigWigFileOpen(fileName);
-boolean ret = bbiSummaryArrayExtended(bbi, chrom, start, end, bigWigIntervalQuery,
+boolean ret = bbiSummaryArrayExtended(bwf, chrom, start, end, bigWigIntervalQuery,
summarySize, summary);
-bbiFileClose(&bbi);
return ret;
}
-double bigWigSingleSummary(char *fileName, char *chrom, int start, int end,
+double bigWigSingleSummary(struct bbiFile *bwf, char *chrom, int start, int end,
enum bbiSummaryType summaryType, double defaultVal)
/* Return the summarized single value for a range. */
{
double arrayOfOne = defaultVal;
-bigWigSummaryArray(fileName, chrom, start, end, summaryType, 1, &arrayOfOne);
+bigWigSummaryArray(bwf, chrom, start, end, summaryType, 1, &arrayOfOne);
return arrayOfOne;
}