5ae4ba6908d8911cf31b84b997563e62a3184195
kate
  Wed Mar 30 18:02:38 2016 -0700
Custom draw code for squish mode. refs #15645

diff --git src/hg/hgTracks/gtexTracks.c src/hg/hgTracks/gtexTracks.c
index 32f6286..65b981b 100644
--- src/hg/hgTracks/gtexTracks.c
+++ src/hg/hgTracks/gtexTracks.c
@@ -455,30 +455,31 @@
 #define MAX_GRAPH_HEIGHT 175
 #define MAX_BAR_WIDTH 5
 #define MAX_GRAPH_PADDING 2
 
 #define WIN_MED_GRAPH 500000
 #define MED_GRAPH_HEIGHT 100
 #define MED_BAR_WIDTH 3
 #define MED_GRAPH_PADDING 1
 
 #define MIN_GRAPH_HEIGHT 35
 #define MIN_BAR_WIDTH 1
 #define MIN_GRAPH_PADDING 0
 
 #define MARGIN_WIDTH 1
 
+
 static int gtexBarWidth()
 {
 long winSize = virtWinBaseCount;
 if (winSize < WIN_MAX_GRAPH)
     return MAX_BAR_WIDTH;
 else if (winSize < WIN_MED_GRAPH)
     return MED_BAR_WIDTH;
 else
     return MIN_BAR_WIDTH;
 }
 
 static enum trackVisibility gtexGeneModelVis(struct gtexGeneExtras *extras)
 {
 long winSize = virtWinBaseCount;
 if (winSize < WIN_MED_GRAPH && !extras->isComparison)
@@ -603,45 +604,65 @@
 Color lighterGray = MAKECOLOR_32(0xF3, 0xF3, 0xF3);
 int width = gtexGraphWidth(tg, geneInfo);
 int height = gtexGeneGraphHeight(tg, geneInfo, TRUE);
 hvGfxOutlinedBox(hvg, x, y-height, width, height, MG_WHITE, lighterGray);
 //hvGfxBox(hvg, x, y-height, width, height, MG_WHITE);
 }
 
 static void drawGraphBase(struct track *tg, struct gtexGeneInfo *geneInfo, struct hvGfx *hvg, int x, int y)
 /* Draw faint line under graph to delineate extent when bars are missing (tissue w/ 0 expression) */
 {
 Color lightGray = MAKECOLOR_32(0xD1, 0xD1, 0xD1);
 int graphWidth = gtexGraphWidth(tg, geneInfo);
 hvGfxBox(hvg, x, y, graphWidth, 1, lightGray);
 }
 
+static void getItemX(int start, int end, int *x1, int *x2)
+/* Return startX, endX based on item coordinates and current window */
+{
+int s = max(start, winStart);
+int e = min(end, winEnd);
+double scale = scaleForWindow(insideWidth, winStart, winEnd);
+assert(x1);
+*x1 = round((double)((int)s-winStart)*scale + insideX);
+assert(x2);
+*x2 = round((double)((int)e-winStart)*scale + insideX);
+}
+
 static void gtexGeneDrawAt(struct track *tg, void *item, struct hvGfx *hvg, int xOff, int y, 
                 double scale, MgFont *font, Color color, enum trackVisibility vis)
 /* Draw tissue expression bar graph over gene model. 
    Optionally, draw a second graph under gene, to compare sample sets */
 {
 struct gtexGeneExtras *extras = (struct gtexGeneExtras *)tg->extraUiData;
 struct gtexGeneInfo *geneInfo = (struct gtexGeneInfo *)item;
 struct gtexGeneBed *geneBed = geneInfo->geneBed;
 // Color in squish mode using geneClass
 Color statusColor = getGeneClassColor(hvg, geneBed);
-if (vis != tvFull && vis != tvPack)
+if (vis == tvDense)
     {
     bedDrawSimpleAt(tg, geneBed, hvg, xOff, y, scale, font, statusColor, vis);
     return;
     }
+if (vis == tvSquish)
+    {
+    int x1, x2;
+    getItemX(geneBed->chromStart, geneBed->chromEnd, &x1, &x2);
+    Color color = gtexGeneItemColor(tg, geneBed, hvg);
+    hvGfxBox(hvg, x1, y, x2-x1, tl.fontHeight/2 + 2, color);
+    return;
+    }
 
 int heightPer = tg->heightPer;
 int graphX = gtexGraphX(geneBed);
 if (graphX < 0)
     return;
 
 // draw gene model
 int topGraphHeight = gtexGeneGraphHeight(tg, geneInfo, TRUE);
 topGraphHeight = max(topGraphHeight, tl.fontHeight);
 int yZero = topGraphHeight + y - 1;  // yZero is bottom of graph
 int yGene = yZero + gtexGeneMargin() - 1;
 tg->heightPer = gtexGeneModelHeight(extras) + 1;
 if (geneInfo->geneModel) // some BEDs do not have a corresponding geneModel record
     {
     struct linkedFeatures *lf = linkedFeaturesFromGenePred(tg, geneInfo->geneModel, FALSE);
@@ -816,42 +837,30 @@
 }
 
 static char *tissueExpressionText(struct gtexTissue *tissue, double expScore, 
                                         boolean doLogTransform, char *qualifier)
 /* Construct mouseover text for tissue graph */
 {
 static char buf[128];
 safef(buf, sizeof(buf), "%s (%.1f %s%s%sRPKM)", tissue->description, 
                                 doLogTransform ? log10(expScore+1.0) : expScore,
                                 qualifier != NULL ? qualifier : "",
                                 qualifier != NULL ? " " : "",
                                 doLogTransform ? "log " : "");
 return buf;
 }
 
-static void getItemX(int start, int end, int *x1, int *x2)
-/* Return startX, endX based on item coordinates and current window */
-{
-int s = max(start, winStart);
-int e = min(end, winEnd);
-double scale = scaleForWindow(insideWidth, winStart, winEnd);
-assert(x1);
-*x1 = round((double)((int)s-winStart)*scale + insideX);
-assert(x2);
-*x2 = round((double)((int)e-winStart)*scale + insideX);
-}
-
 static void gtexGeneMapItem(struct track *tg, struct hvGfx *hvg, void *item, char *itemName, 
                         char *mapItemName, int start, int end, int x, int y, int width, int height)
 /* Create a map box on gene model and label, and one for each tissue (bar in the graph) in
  * pack or full mode.  Just single map for squish/dense modes */
 {
 if (tg->visibility == tvDense)
     {
     genericMapItem(tg, hvg, item, itemName, itemName, start, end, x, y, width, height);
     return;
     }
 struct gtexGeneInfo *geneInfo = item;
 struct gtexGeneBed *geneBed = geneInfo->geneBed;
 struct gtexGeneExtras *extras = (struct gtexGeneExtras *)tg->extraUiData;
 if (tg->visibility == tvSquish)
     {