4915a88e2c772b27f402db699413ef28a5d4e08d kate Fri Mar 9 11:36:51 2018 -0800 Add some info to mouseovers of unnamed interactions. refs #17512 diff --git src/hg/hgTracks/interactTrack.c src/hg/hgTracks/interactTrack.c index 8ade8cb..0e21a78 100644 --- src/hg/hgTracks/interactTrack.c +++ src/hg/hgTracks/interactTrack.c @@ -1,21 +1,22 @@ /* interactTrack -- draw interaction between two genomic regions */ /* Copyright (C) 2018 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include "common.h" +#include "obscure.h" #include "hgTracks.h" #include "interact.h" #include "interactUi.h" static int interactTotalHeight(struct track *tg, enum trackVisibility vis) /* calculate height of all the interactions being displayed */ { if ( tg->visibility == tvDense) return tl.fontHeight; int min, max, deflt, current; cartTdbFetchMinMaxPixels(cart, tg->tdb, INTERACT_MINHEIGHT, INTERACT_MAXHEIGHT, atoi(INTERACT_DEFHEIGHT), &min, &max, &deflt, ¤t); return tg->height = current; } @@ -103,33 +104,49 @@ prevLabelStart = labelStart; prevLabelEnd = labelEnd; prevLabel = otherChrom; } } int fontHeight = vgGetFontPixelHeight(hvg->vg, font); int otherHeight = (nOther) ? 3 * fontHeight : 0; int sameHeight = (nSame) ? tg->height - otherHeight: 0; // Draw items for (inter=inters; inter; inter=inter->next) { char *otherChrom = interactOtherChrom(inter); safef(itemBuf, sizeof itemBuf, "%s", inter->name); struct dyString *ds = dyStringNew(0); + if (isEmpty(inter->name)) + { + if (isNotEmpty(inter->exp)) + dyStringPrintf(ds, "%s ", inter->exp); + if (otherChrom) + dyStringPrintf(ds, "%s", otherChrom); + else + { + char buf[4096]; + sprintLongWithCommas(buf, inter->chromEnd - inter->chromStart); + dyStringPrintf(ds, "%s bp", buf); + } + } + else dyStringPrintf(ds, "%s", inter->name); if (inter->score) dyStringPrintf(ds, " %d", inter->score); + if (inter->value != 0.0) + dyStringPrintf(ds, " %0.2f", inter->value); char *statusBuf = dyStringCannibalize(&ds); color = interactItemColor(tg, inter, hvg); if (vis == tvDense && interactOtherChrom(inter) && color == MG_BLACK) color = MG_MAGENTA; // TODO: simplify by using start/end instead of center and width // This is a holdover from longRange track implementation unsigned lowStart, lowEnd, highStart, highEnd; if (otherChrom) { lowStart = highStart = inter->chromStart; lowEnd = highEnd = inter->chromEnd; } else if (inter->sourceStart < inter->targetStart)