85bd10da37f403d155c4434d90edcd146e682948 braney Mon May 15 13:03:32 2017 -0700 add sorting to composite wiggles. diff --git src/hg/hgTracks/multiWig.c src/hg/hgTracks/multiWig.c index a5f793a..8094afe 100644 --- src/hg/hgTracks/multiWig.c +++ src/hg/hgTracks/multiWig.c @@ -215,64 +215,77 @@ ++p; } } if (alwaysZero == wiggleAlwaysZeroOn) { if ( max < 0) max = 0.0; else if ( min > 0) min = 0.0; } *retMax = max; *retMin = min; } -static struct wigGraphOutput *setUpWgo(int xOff, int yOff, int width, int height, int numTracks, struct wigCartOptions *wigCart, struct hvGfx *hvg) +void AllocPixelBins(struct wigGraphOutput *wgo, int width) +{ +struct pixelCountBin *bins; + +AllocVar(bins); + +wgo->pixelBins = bins; +bins->binSize = 1; +bins->binCount = width / bins->binSize + 1; +AllocArray(bins->bins, bins->binCount); +} + +struct wigGraphOutput *setUpWgo(int xOff, int yOff, int width, int height, int numTracks, struct wigCartOptions *wigCart, struct hvGfx *hvg) { /* Deal with tranparency possibly */ -struct wigGraphOutput *wgo; +struct wigGraphOutput *wgo = NULL; struct floatPic *floatPic = NULL; switch(wigCart->aggregateFunction) { case wiggleAggregateTransparent: { //int height = tg->lineHeight; floatPic = floatPicNew(width, height); floatPicSet(floatPic, 1, 1, 1); wgo = wigGraphOutputTransparent(floatPic); break; } case wiggleAggregateSubtract: case wiggleAggregateNone: case wiggleAggregateAdd: case wiggleAggregateSolid: { wgo = wigGraphOutputSolid(xOff, yOff, hvg); break; } case wiggleAggregateStacked: { wgo = wigGraphOutputStack(xOff, yOff, width, numTracks, hvg); break; } default: { errAbort("bad aggregate function (value: %d)\n", wigCart->aggregateFunction); break; } } +AllocPixelBins(wgo, width); return wgo; } static void multiWigPreDraw(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont *font, Color color, enum trackVisibility vis) /* Pre-Draw multiWig container calls preDraw on all subtracks. */ { int y = yOff; // The y value here should not matter. struct track *subtrack; struct wigCartOptions *wigCart = tg->wigCartData; // we want to the order to be the same in all the modes