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/bwgInternal.h src/inc/bwgInternal.h index 3c6bad3..fab20ab 100644 --- src/inc/bwgInternal.h +++ src/inc/bwgInternal.h @@ -64,30 +64,46 @@ * structure used by the bigWig creation code. See also bwgSection for the * structure returned by the bigWig reading code. */ { struct bwgSection *next; /* Next in list. */ char *chrom; /* Chromosome name. */ bits32 start,end; /* Range of chromosome covered. */ enum bwgSectionType type; union bwgItem items; /* List/array of items in this section. */ bits32 itemStep; /* Step within item if applicable. */ bits32 itemSpan; /* Item span if applicable. */ bits16 itemCount; /* Number of items in section. */ bits32 chromId; /* Unique small integer value for chromosome. */ bits64 fileOffset; /* Offset of section in file. */ }; +struct bwgSectionHead +/* A header from a bigWig file section - similar to above bug what is on disk. */ + { + bits32 chromId; /* Chromosome short identifier. */ + bits32 start,end; /* Range covered. */ + bits32 itemStep; /* For some section types, the # of bases between items. */ + bits32 itemSpan; /* For some section types, the # of bases in each item. */ + UBYTE type; /* Type byte. */ + UBYTE reserved; /* Always zero for now. */ + bits16 itemCount; /* Number of items in block. */ + }; + +void bwgSectionHeadFromMem(char **pPt, struct bwgSectionHead *head, boolean isSwapped); +/* Read section header. */ + + int bwgSectionCmp(const void *va, const void *vb); /* Compare to sort based on chrom,start,end. */ struct bwgSection *bwgParseWig( char *fileName, /* Name of ascii wig file. */ boolean clipDontDie, /* Skip items outside chromosome rather than aborting. */ struct hash *chromSizeHash, /* If non-NULL items checked to be inside chromosome. */ int maxSectionSize, /* Biggest size of a section. 100 - 100,000 is usual range. */ struct lm *lm); /* Memory pool to allocate from. */ /* Parse out ascii wig file - allocating memory in lm. */ int bwgAverageResolution(struct bwgSection *sectionList); /* Return the average resolution seen in sectionList. */ struct bbiSummary *bwgReduceSectionList(struct bwgSection *sectionList,