1156e1e9fd3c14d702772fdd0ff3978049f9e764 kent Tue Mar 29 14:33:06 2011 -0700 Having bigWigValsOnChromFetchData read bigWig directly rather than going through bigWigIntervalQuery in hopes of speeding up particularly on things that have a value for each base and are stored as fixedStep. It does speed it up by 2x when you are not too i/o bound. diff --git src/inc/bigWig.h src/inc/bigWig.h index d705c59..d6fcb60 100644 --- src/inc/bigWig.h +++ src/inc/bigWig.h @@ -63,34 +63,44 @@ 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. */ double bigWigSingleSummary(struct bbiFile *bwf, char *chrom, int start, int end, enum bbiSummaryType summaryType, double defaultVal); /* Return the summarized single value for a range. */ boolean isBigWig(char *fileName); /* Peak at a file to see if it's bigWig */ boolean bigWigFileCheckSigs(char *fileName); /* check file signatures at beginning and end of file */ +/* bigWigValsOnChrom - a little system for optimizing bigWig use when doing a pass over the + * whole chromosome. How it is used typically is: + * struct bigWigValsOnChrom *chromVals = bigWigValsOnChromNew(); + * for (chrom = chromList; chrom != NULL; chrom = chrom->next) + * { + * if (bigWigValsOnChromFetchData(chromVals, chrom->name, bigWig)) + * // do stuff using the valBuf, or covBuf fields which have + * // the big wig data unpacked into them. Can use chromSize and chrom too + * } + * bigWigValsOnChromFree(&chromVals); */ struct bigWigValsOnChrom /* Object for bulk access a chromosome at a time. This is faster than - * doing bigWigInterval queries when you have ~5000 or more queries. */ + * doing bigWigInterval queries when you have ~3000 or more queries. */ { struct bigWigValsOnChrom *next; char *chrom; /* Current chromosome. */ long chromSize; /* Size of current chromosome. */ long bufSize; /* Size of allocated buffer */ double *valBuf; /* A value for each base on chrom. Zero where no data. */ Bits *covBuf; /* A bit for each base with data. */ }; struct bigWigValsOnChrom *bigWigValsOnChromNew(); /* Allocate new empty bigWigValsOnChromStructure. */ void bigWigValsOnChromFree(struct bigWigValsOnChrom **pChromVals); /* Free up bigWigValsOnChrom */