de2d4b32bb2cf74eb931862533b7966acb4f2378 jcasper Wed Jul 24 22:52:56 2019 -0700 Changes in response to code review, refs #23853 diff --git src/hg/hgTracks/hicTrack.c src/hg/hgTracks/hicTrack.c index 2b8db88..3de1c1a 100644 --- src/hg/hgTracks/hicTrack.c +++ src/hg/hgTracks/hicTrack.c @@ -101,32 +101,32 @@ struct interact *thisHic = hicItems; while (thisHic != NULL) { char *drawMode = hicUiFetchDrawMode(cart, tg->track); if (sameString(drawMode, HIC_DRAW_MODE_ARC)) { // we omit self-interactions in arc mode (they'd just be weird vertical lines) if (sameString(thisHic->sourceChrom, thisHic->targetChrom) && (thisHic->sourceStart == thisHic->targetStart)) continue; } countsCopy[filtNumRecords++] = thisHic->value; // Calculate the track draw height required to see this item - int leftx = thisHic->chromStart > winStart ? thisHic->chromStart : winStart; - int rightx = thisHic->chromEnd < winEnd ? thisHic->chromEnd : winEnd; + int leftx = max(thisHic->chromStart, winStart); + int rightx = min(thisHic->chromEnd, winEnd); double thisHeight = scaleForWindow(insideWidth, winStart, winEnd)*(rightx - leftx)/2.0; // triangle or arc if (sameString(drawMode,HIC_DRAW_MODE_SQUARE)) thisHeight = scaleForWindow(insideWidth, winStart, winEnd)*(winEnd-winStart); // square - always draw the full square if (thisHeight > tg->maxRange) tg->maxRange = thisHeight; thisHic = thisHic->next; } // Heuristic for auto-scaling the color gradient based on the scores in view - draw the max color value // at or above 2*median score. tg->graphUpperLimit = 2.0*doubleMedian(filtNumRecords, countsCopy); free(countsCopy); tg->items = hicItems; }