5c57a29b664add8c4b3b3fe647e74e319d2351bb braney Thu Jan 26 10:02:44 2017 -0800 fix #18746 diff --git src/hg/hgTracks/wigMafTrack.c src/hg/hgTracks/wigMafTrack.c index 3ae9816..ae79ef4 100644 --- src/hg/hgTracks/wigMafTrack.c +++ src/hg/hgTracks/wigMafTrack.c @@ -958,30 +958,60 @@ { Color fuzz = shadesOfGray[2]; x1 = round((double)((int)ms->chromEnd+1 - seqStart) * scale) + xOff; x2 = round((double)((int)ms->next->chromStart-1 - seqStart) * scale) + xOff ; w = x2 - x1; if (w == 1 && x1 == lastX) continue; if (w > 0) hvGfxBox(hvg, x1, yOff, w, height, fuzz); } } } } +static void drawScoreOverviewBig( struct track *track, int height, + int seqStart, int seqEnd, + struct hvGfx *hvg, int xOff, int yOff, + int width, MgFont *font, + Color color, Color altColor, + enum trackVisibility vis) +/* Draw density plot or graph for overall maf scores rather than computing + * by sections, for speed. Don't actually load the mafs -- just + * the scored refs from the table. + */ +{ +struct lm *lm = lmInit(0); +char *fileName = trackDbSetting(track->tdb, "summary"); +struct bbiFile *bbi = bigBedFileOpen(fileName); +struct bigBedInterval *bb, *bbList = bigBedIntervalQuery(bbi, chromName, seqStart, seqEnd, 0, lm); +char *bedRow[7]; +char startBuf[16], endBuf[16]; +double scale = scaleForPixels(width); + +for (bb = bbList; bb != NULL; bb = bb->next) + { + bigBedIntervalToRow(bb, chromName, startBuf, endBuf, bedRow, ArraySize(bedRow)); + struct mafSummary *ms; + ms = mafSummaryLoad(bedRow); + drawScore(ms->score, ms->chromStart, ms->chromEnd, seqStart, scale, + hvg, xOff, yOff, height, color, vis); + + } +} + static void drawScoreOverviewC(struct sqlConnection *conn, char *tableName, int height, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont *font, Color color, Color altColor, enum trackVisibility vis) /* Draw density plot or graph for overall maf scores rather than computing * by sections, for speed. Don't actually load the mafs -- just * the scored refs from the table. * TODO: reuse code in mafTrack.c */ { char **row; int rowOffset; @@ -2563,30 +2593,33 @@ doSnpMode); } else if (mp->ct != NULL) { /* use or scored refs from maf table*/ drawScoreOverviewCT(mp->ct->dbTableName, height, seqStart, seqEnd, hvg, xOff, yOff, width, font, color, color, scoreVis); yOff++; } else { /* use or scored refs from maf table*/ if (differentString(track->tdb->type, "bigMaf")) drawScoreOverview(track->table, height, seqStart, seqEnd, hvg, xOff, yOff, width, font, color, color, scoreVis); + else + drawScoreOverviewBig(track, height, seqStart, seqEnd, hvg, + xOff, yOff, width, font, color, color, scoreVis); yOff++; } yOff += height; } else { Color wigColor = 0; while (wigTrack != NULL) { /* draw conservation wiggles */ if (!wigColor) wigColor = hvGfxFindRgb(hvg, &wigTrack->color); else wigColor = slightlyLighterColor(hvg, wigColor); wigTrack->ixColor = wigColor;