f309250d6d5934baf893f66405952d1f91f98ffe hiram Thu Oct 22 16:00:02 2020 -0700 feature is still off but has been improved with json data sent to the client refs #21980 diff --git src/hg/hgTracks/wigTrack.c src/hg/hgTracks/wigTrack.c index bea7334..de45c0e 100644 --- src/hg/hgTracks/wigTrack.c +++ src/hg/hgTracks/wigTrack.c @@ -10,31 +10,32 @@ #include "hash.h" #include "linefile.h" #include "jksql.h" #include "hdb.h" #include "hgTracks.h" #include "wiggle.h" #include "hmmstats.h" #include "scoredRef.h" #ifndef GBROWSE #include "customTrack.h" #endif /* GBROWSE */ #include "wigCommon.h" #include "imageV2.h" #include "memgfx.h" #include "udc.h" - +#include "trashDir.h" +#include "jsonWrite.h" struct wigItem /* A wig track item. */ { struct wigItem *next; int start, end; /* Start/end in chrom (aka browser) coordinates. */ char *db; /* Database */ int ix; /* Position in list. */ int height; /* Pixel height of item. */ unsigned span; /* each value spans this many bases */ unsigned count; /* number of values to use */ unsigned offset; /* offset in File to fetch data */ char *file; /* path name to data file, one byte per value */ double lowerLimit; /* lowest data value in this block */ double dataRange; /* lowerLimit + dataRange = upperLimit */ @@ -1431,49 +1432,73 @@ wigTrackSetGraphOutputDefault(tg, xOff, yOff, width, hvg); graphPreDrawContainer(preContainer, preDrawZero, width, tg, hvg, xOff, yOff, graphUpperLimit, graphLowerLimit, graphRange, vis, wigCart); drawZeroLine(vis, wigCart->horizontalGrid, graphUpperLimit, graphLowerLimit, hvg, xOff, yOff, width, tg->lineHeight); drawArbitraryYLine(vis, (enum wiggleGridOptEnum)wigCart->yLineOnOff, graphUpperLimit, graphLowerLimit, hvg, xOff, yOff, width, tg->lineHeight, wigCart->yLineMark, graphRange, wigCart->yLineOnOff); -#ifdef NOT_YET_TOO_SLOW +#ifdef NOT_READY_TO_GO if (mouseOverData) { + struct tempName jsonData; + trashDirFile(&jsonData, "hgt", tg->track, ".json"); + FILE *trashJson = mustOpen(jsonData.forCgi, "w"); + struct jsonWrite *jw = jsonWriteNew(); + jsonWriteObjectStart(jw, NULL); + jsonWriteListStart(jw, tg->track); int i; /* could put up a 'no data' box when these items are not contiguous * e.g. when gaps interrupt the track data */ for (i = 0; i <= mouseOverIdx; ++i) { - char value[64]; - safef(value, sizeof(value), " %g", mouseOverData[i].value); - mapBoxHc(hvg, seqStart, seqEnd, mouseOverData[i].x, mouseOverData[i].y, mouseOverData[i].width, mouseOverData[i].height, - tg->track, value, value); - } + jsonWriteObjectStart(jw, NULL); + jsonWriteNumber(jw, "x1", (long long)mouseOverData[i].x); + jsonWriteNumber(jw, "y1", (long long)mouseOverData[i].y); + jsonWriteNumber(jw, "x2", (long long)(mouseOverData[i].x + mouseOverData[i].width)); + jsonWriteNumber(jw, "y2", (long long)(mouseOverData[i].y + mouseOverData[i].height)); + jsonWriteDouble(jw, "v", mouseOverData[i].value); + jsonWriteObjectEnd(jw); + } + jsonWriteListEnd(jw); + jsonWriteObjectEnd(jw); + fputs(jw->dy->string,trashJson); + // This is the hidden signal to the javaScript of where to pick up + // the json file + hPrintf("\n", tg->track, jsonData.forHtml); + hPrintf("\n"); + carefulClose(&trashJson); } else #endif wigMapSelf(tg, hvg, seqStart, seqEnd, xOff, yOff, width); +#ifdef NOT_READY_TO_GO +hPrintf("
\n"); +hPrintf(" \n"); +// hPrintf("

. . . mouse over values

\n"); +hPrintf("
\n"); +hPrintf("
\n"); +#endif } struct preDrawContainer *wigLoadPreDraw(struct track *tg, int seqStart, int seqEnd, int width) /* Do bits that load the predraw buffer tg->preDrawContainer. */ { /* Just need to do this once... */ if (tg->preDrawContainer) return tg->preDrawContainer; struct wigItem *wi; double pixelsPerBase = scaleForPixels(width); double basesPerPixel = 1.0; int itemCount = 0; char *currentFile = NULL; //char *currentFileRewrite = NULL;