src/inc/bwgInternal.h 1.10
1.10 2010/05/29 22:28:44 kent
Moving some stuff from bwgCreate to bwgInternal.h where it can be shared a bit more. Tweaking things so first zoom level is a better size, which speeds up 100k views.
Index: src/inc/bwgInternal.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/inc/bwgInternal.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -b -B -U 4 -r1.9 -r1.10
--- src/inc/bwgInternal.h 4 Feb 2009 22:27:20 -0000 1.9
+++ src/inc/bwgInternal.h 29 May 2010 22:28:44 -0000 1.10
@@ -13,10 +13,79 @@
bwgTypeVariableStep=2,
bwgTypeFixedStep=3,
};
-struct bwgSection *bwgParseWig(char *fileName, boolean clipDontDie, struct hash *chromSizeHash,
- int maxSectionSize, struct lm *lm);
+struct bwgBedGraphItem
+/* An bedGraph-type item in a bwgSection. */
+ {
+ struct bwgBedGraphItem *next; /* Next in list. */
+ bits32 start,end; /* Range of chromosome covered. */
+ float val; /* Value. */
+ };
+
+struct bwgVariableStepItem
+/* An variableStep type item in a bwgSection. */
+ {
+ struct bwgVariableStepItem *next; /* Next in list. */
+ bits32 start; /* Start position in chromosome. */
+ float val; /* Value. */
+ };
+
+struct bwgVariableStepPacked
+/* An variableStep type item in a bwgSection. */
+ {
+ bits32 start; /* Start position in chromosome. */
+ float val; /* Value. */
+ };
+
+struct bwgFixedStepItem
+/* An fixedStep type item in a bwgSection. */
+ {
+ struct bwgFixedStepItem *next; /* Next in list. */
+ float val; /* Value. */
+ };
+
+struct bwgFixedStepPacked
+/* An fixedStep type item in a bwgSection. */
+ {
+ float val; /* Value. */
+ };
+
+union bwgItem
+/* Union of item pointers for all possible section types. */
+ {
+ struct bwgBedGraphItem *bedGraphList; /* A linked list */
+ struct bwgFixedStepPacked *fixedStepPacked; /* An array */
+ struct bwgVariableStepPacked *variableStepPacked; /* An array */
+ /* No packed format for bedGraph... */
+ };
+
+struct bwgSection
+/* A section of a bigWig file - all on same chrom. This is a somewhat fat data
+ * 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. */
+ };
+
+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. */