bb7c285d51eabd45fe7fbb3ae297acd0324915b7 kent Tue Apr 19 15:09:50 2011 -0700 Refactoring in hopes of making auto-scale work as you'd hope with multiwigs. That still isn't there, this is just preliminaries. diff --git src/hg/hgTracks/wigCommon.h src/hg/hgTracks/wigCommon.h index 7da3ae8..4c43fc2 100644 --- src/hg/hgTracks/wigCommon.h +++ src/hg/hgTracks/wigCommon.h @@ -15,67 +15,72 @@ enum wiggleScaleOptEnum autoScale; /* autoScale on */ enum wiggleWindowingEnum windowingFunction; /* max,mean,min */ enum wiggleSmoothingEnum smoothingWindow; /* N: [1:15] */ enum wiggleYLineMarkEnum yLineOnOff; /* OFF/ON */ enum wiggleAlwaysZeroEnum alwaysZero; /* OFF/ON */ enum wiggleTransformFuncEnum transformFunc; /* NONE/LOG */ double minY; /* from trackDb.ra words, the absolute minimum */ double maxY; /* from trackDb.ra words, the absolute maximum */ int maxHeight; /* maximum pixels height from trackDb */ int defaultHeight; /* requested height from cart */ int minHeight; /* minimum pixels height from trackDb */ double yLineMark; /* user requested line at y = */ char *colorTrack; /* Track to use for coloring wiggle track. */ int graphColumn; /* column to be graphing (bedGraph tracks) */ boolean bedGraph; /* is this a bedGraph track ? */ + boolean isMultiWig; /* If true it's a multi-wig. */ + boolean overlay; /* Overlay multiple wigs on top of each other? */ }; struct wigCartOptions *wigCartOptionsNew(struct cart *cart, struct trackDb *tdb, int wordCount, char *words[]); /* Create a wigCartOptions from cart contents and tdb. */ struct preDrawContainer +/* A list of preDraws */ { struct preDrawContainer *next; struct preDrawElement *preDraw; + int preDrawSize; /* Size of preDraw */ + int preDrawZero; /* Offset from start of predraw array to data requested. We + * get more because of smoothing */ }; struct preDrawElement { double max; /* maximum value seen for this point */ double min; /* minimum value seen for this point */ unsigned long long count; /* number of datum at this point */ double sumData; /* sum of all values at this point */ double sumSquares; /* sum of (values squared) at this point */ double plotValue; /* raw data to plot */ double smooth; /* smooth data values */ }; struct bedGraphItem /* A bedGraph track item. */ { struct bedGraphItem *next; int start, end; /* Start/end in chrom coordinates. */ char *name; /* Common name */ float dataValue; /* data value from bed table graphColumn */ double graphUpperLimit; /* filled in by DrawItems */ double graphLowerLimit; /* filled in by DrawItems */ }; /* source to these routines is in wigTrack.c */ -struct preDrawElement * initPreDraw(int width, int *preDrawSize, - int *preDrawZero); +struct preDrawContainer *initPreDrawContainer(int width); /* initialize a preDraw array of size width */ void preDrawWindowFunction(struct preDrawElement *preDraw, int preDrawSize, enum wiggleWindowingEnum windowingFunction, enum wiggleTransformFuncEnum transformFunc); /* apply windowing function to the values in preDraw array */ void preDrawSmoothing(struct preDrawElement *preDraw, int preDrawSize, enum wiggleSmoothingEnum smoothingWindow); /* apply smoothing function to preDraw array */ double preDrawLimits(struct preDrawElement *preDraw, int preDrawZero, int width, double *overallUpperLimit, double *overallLowerLimit); /* scan preDraw array and determine graph limits */