dbff2df65c339ba878154eda07fd5ce60a2383c3 braney Fri Dec 5 17:07:07 2014 -0800 add the ability to get coverage (wiggle) plots for bed type tracks #952 diff --git src/hg/hgTracks/wigTrack.c src/hg/hgTracks/wigTrack.c index eb92b3b..004ba17 100644 --- src/hg/hgTracks/wigTrack.c +++ src/hg/hgTracks/wigTrack.c @@ -118,31 +118,31 @@ } if(colorTrack->drawItemAt == linkedFeaturesDrawAt) wigFillInColorLfArray(wigTrack, colorArray, colSize, colorTrack); else if(colorTrack->drawItemAt == bedDrawSimpleAt) wigFillInColorBedArray(wigTrack, colorArray, colSize, colorTrack, hvg); if(trackLoaded && colorTrack->freeItems != NULL) colorTrack->freeItems(colorTrack); } void wigSetCart(struct track *track, char *dataID, void *dataValue) /* set one of the variables in the wigCart. Actually just MIN_Y or MAX_Y */ { struct wigCartOptions *wigCart; -wigCart = (struct wigCartOptions *) track->extraUiData; +wigCart = (struct wigCartOptions *) track->wigCartData; if (sameWord(dataID, MIN_Y)) wigCart->minY = *((double *)dataValue); else if (sameWord(dataID, MAX_Y)) wigCart->maxY = *((double *)dataValue); else internalErr(); } /* these two routines unused at this time */ #if defined(NOT) static void wigItemFree(struct wigItem **pEl) /* Free up a wigItem. */ { struct wigItem *el = *pEl; @@ -221,31 +221,31 @@ #endif #define FONT_HEIGHT (tl.fontHeight) #define WIG_DENSE_HEIGHT FONT_HEIGHT #define WIG_PACK_HEIGHT FONT_HEIGHT #define WIG_SQUISH_HEIGHT (((FONT_HEIGHT/2) & 1) ? (FONT_HEIGHT/2) : (FONT_HEIGHT/2) - 1) int wigTotalHeight(struct track *tg, enum trackVisibility vis) /* Wiggle track will use this to figure out the height they use as defined in the cart */ { struct wigCartOptions *wigCart; int saveHeight = tg->height; -wigCart = (struct wigCartOptions *) tg->extraUiData; +wigCart = (struct wigCartOptions *) tg->wigCartData; /* * A track is just one * item, so there is nothing to do here, either it is the tvFull * height as chosen by the user from TrackUi, or it is the dense * mode. * ADDENDUM: wiggle options for squish and pack are being added. */ /* Wiggle tracks depend upon clipping. They are reporting * totalHeight artifically high by 1 so this will leave a * blank area one pixel high below the track. hgTracks will set * our clipping rectangle one less than what we report here to get * this accomplished. In the meantime our actual drawing height is * recorded properly in lineHeight, heightPer and height */ @@ -1219,31 +1219,31 @@ MgFont *font, Color color, enum trackVisibility vis, struct preDrawContainer *preContainer, int preDrawZero, int preDrawSize, double *retGraphUpperLimit, double *retGraphLowerLimit) /* Draw once we've figured out predraw (numerical values to graph) we draw it here. * This code is shared by wig, bigWig, and bedGraph drawers. */ { wigTrackSetGraphOutputDefault(tg, xOff, yOff, hvg); enum wiggleYLineMarkEnum yLineOnOff; double yLineMark; /* determined from data */ double graphUpperLimit=0; /* scaling choice will set these */ double graphLowerLimit=0; /* scaling choice will set these */ double graphRange=0; /* scaling choice will set these */ double epsilon; /* range of data in one pixel */ -struct wigCartOptions *wigCart = (struct wigCartOptions *) tg->extraUiData; +struct wigCartOptions *wigCart = (struct wigCartOptions *) tg->wigCartData; yLineOnOff = wigCart->yLineOnOff; yLineMark = wigCart->yLineMark; /* width - width of drawing window in pixels * pixelsPerBase - pixels per base * basesPerPixel - calculated as 1.0/pixelsPerBase */ struct preDrawElement *preDraw = preContainer->preDraw; if (preContainer->smoothingDone == FALSE) { preDrawWindowFunction(preDraw, preDrawSize, wigCart->windowingFunction, wigCart->transformFunc, wigCart->doNegative); @@ -1480,31 +1480,31 @@ } } void wigLeftAxisLabels(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, int height, boolean withCenterLabels, MgFont *font, Color color, enum trackVisibility vis, char *shortLabel, double graphUpperLimit, double graphLowerLimit, boolean showNumbers) /* Draw labels on left for a wiggle-type track. */ { int fontHeight = tl.fontHeight+1; int centerOffset = 0; double lines[2]; /* lines to label */ int numberOfLines = 1; /* at least one: 0.0 */ int i; /* loop counter */ -struct wigCartOptions *wigCart = (struct wigCartOptions *) tg->extraUiData; +struct wigCartOptions *wigCart = (struct wigCartOptions *) tg->wigCartData; lines[0] = 0.0; lines[1] = wigCart->yLineMark; if (wigCart->yLineOnOff == wiggleYLineMarkOn) ++numberOfLines; if (withCenterLabels) centerOffset = fontHeight; /* We only do Dense and Full */ if (tg->limitedVis == tvDense) { hvGfxTextRight(hvg, xOff, yOff+centerOffset, width - 1, height-centerOffset, tg->ixColor, font, shortLabel); } @@ -1694,23 +1694,23 @@ track->graphLowerLimit = wigEncodeStartingLowerLimit; wigCart->bedGraph = FALSE; /* signal to left labels */ track->loadItems = wigLoadItems; track->freeItems = wigFreeItems; track->drawItems = wigDrawItems; track->itemName = wigNameCallback; track->mapItemName = wigNameCallback; track->totalHeight = wigTotalHeight; track->itemHeight = tgFixedItemHeight; track->itemStart = tgItemNoStart; track->itemEnd = tgItemNoEnd; /* the wigMaf parent will turn mapsSelf off */ track->mapsSelf = TRUE; -track->extraUiData = (void *) wigCart; +track->wigCartData = (void *) wigCart; track->colorShades = shadesOfGray; track->drawLeftLabels = wigLeftLabels; track->loadPreDraw = wigLoadPreDraw; /* the lfSubSample type makes the image map function correctly */ track->subType = lfSubSample; /*make subType be "sample" (=2)*/ } /* wigMethods() */