b1ae6aafe2f0997af978f7984c270fbe3c1edb4a
kate
  Wed Jan 17 17:40:46 2018 -0800
Add feature to draw dotted lines for reverse direction interactions. refs #17512

diff --git src/hg/hgTracks/interactTrack.c src/hg/hgTracks/interactTrack.c
index bbe8a72..88e2563 100644
--- src/hg/hgTracks/interactTrack.c
+++ src/hg/hgTracks/interactTrack.c
@@ -175,31 +175,34 @@
             {
             height = tg->height;
             }
         else
             {
             height = otherHeight/2;
             yOffOther = yOff + sameHeight;
             }
         yPos = yOffOther + height;
 
         // draw the foot
         int footWidth = sFootWidth;
         hvGfxLine(hvg, sx - footWidth, yOffOther, sx + footWidth, yOffOther, color);
 
         // draw the vertical
+        if (inter->strand[0] == '+')
             hvGfxLine(hvg, sx, yOffOther, sx, yPos, color);
+        else
+            hvGfxDottedLine(hvg, sx, yOffOther, sx, yPos, color);
         if (tg->visibility == tvFull)
             {
             mapBoxHgcOrHgGene(hvg, s, s, sx - 2, yOffOther, 4, height,
                                    tg->track, itemBuf, statusBuf, NULL, TRUE, NULL);
 
             safef(buffer, sizeof buffer, "%s", inter->chrom2);
             if (doOtherLabels)
                 {
                 hvGfxTextCentered(hvg, sx, yPos + 2, 4, 4, MG_BLUE, font, buffer);
                 int width = vgGetFontStringWidth(hvg->vg, font, buffer);
                 mapBoxHgcOrHgGene(hvg, s, s, sx - width/2, yPos, 
                                 width, fontHeight, tg->track, itemBuf, statusBuf, NULL, TRUE, NULL);
                 }
             }
         continue;
@@ -217,77 +220,92 @@
     double interWidth = e - s;
     int peakHeight = (sameHeight - 15) * ((double)interWidth / maxWidth) + 10;
     int peak = yOff + peakHeight;
     if (tg->visibility == tvDense)
         peak = yOff + tg->height;
 
     if (sOnScreen)
         {
         // draw foot of first region and mapbox
         hvGfxLine(hvg, sx - sFootWidth, yOff, sx + sFootWidth, yOff, color);
         mapBoxHgcOrHgGene(hvg, inter->chromStart, inter->chromEnd, 
                             sx - sFootWidth - 2, yOff, sx + sFootWidth + 2, 4,
                             tg->track, itemBuf, statusBuf, NULL, TRUE, NULL);
         // draw vertical
         if (!eOnScreen || draw == DRAW_LINE)
+            {
+            if (inter->strand[0] == '-')
+                hvGfxDottedLine(hvg, sx, yOff, sx, peak, color);
+            else
                 hvGfxLine(hvg, sx, yOff, sx, peak, color);
             }
+        }
     if (eOnScreen)
         {
         // draw foot and mapbox of second region
         hvGfxLine(hvg, ex - eFootWidth, yOff, ex + eFootWidth, yOff, color);
         mapBoxHgcOrHgGene(hvg, inter->chromStart, inter->chromEnd, 
                             ex - eFootWidth - 2, yOff, ex + eFootWidth + 2, 4,
                             tg->track, itemBuf, statusBuf, NULL, TRUE, NULL);
 
         // draw vertical
         if (!sOnScreen || draw == DRAW_LINE)
+            {
+            if (inter->strand[0] == '-')
+                hvGfxDottedLine(hvg, ex, yOff, ex, peak, color); //OLD
+            else
                 hvGfxLine(hvg, ex, yOff, ex, peak, color); //OLD
             }
+        }
     if (tg->visibility == tvFull)
         {
         if (sOnScreen && eOnScreen && draw != DRAW_LINE)
             {
+            boolean isDotted = (inter->strand[0] == '-');
             if (draw == DRAW_CURVE)
                 {
                 int peakX = ((ex - sx + 1) / 2) + sx;
                 int peakY = peak + 60;
-                hvGfxCurve(hvg, sx, yOff, peakX, peakY, ex, yOff, color);
+                hvGfxCurve(hvg, sx, yOff, peakX, peakY, ex, yOff, color, isDotted);
                 // map box on peak
                 // FIXME: not working
-                mapBoxHgcOrHgGene(hvg, inter->chromStart, inter->chromEnd,
+                /*mapBoxHgcOrHgGene(hvg, inter->chromStart, inter->chromEnd,
                                     peakX - 2, peakY - 2, 4, 4,
                                     tg->track, itemBuf, statusBuf, NULL, TRUE, NULL);
+*/
                 }
             else if (draw == DRAW_ELLIPSE)
                 {
                 int yLeft = yOff + peakHeight;
                 int yTop = yOff - peakHeight;
-                //hvGfxEllipseDrawAA(hvg, sx, yLeft, ex, yTop, color, ELLIPSE_BOTTOM); // demo
-                hvGfxEllipseDraw(hvg, sx, yLeft, ex, yTop, color, ELLIPSE_BOTTOM); // demo
+                hvGfxEllipseDraw(hvg, sx, yLeft, ex, yTop, color, ELLIPSE_BOTTOM, isDotted);
                 // map box on peak
                 // FIXME: not working
-                mapBoxHgcOrHgGene(hvg, inter->chromStart, inter->chromEnd,
+                /*mapBoxHgcOrHgGene(hvg, inter->chromStart, inter->chromEnd,
                                     sx - sFootWidth - 2, yOff + peakHeight, 4, 4,
                                     tg->track, itemBuf, statusBuf, NULL, TRUE, NULL);
+*/
                 }
             }
         else
             {
             // draw link horizontal line between regions (dense mode just shows feet ??)
             unsigned ePeak = eOnScreen ? ex : xOff + width;
             unsigned sPeak = sOnScreen ? sx : xOff;
+            if (inter->strand[0] == '-')
+                hvGfxDottedLine(hvg, sPeak, peak, ePeak, peak, color);
+            else
                 hvGfxLine(hvg, sPeak, peak, ePeak, peak, color);
 
             // map box on horizontal line
             mapBoxHgcOrHgGene(hvg, s, e, sPeak, peak-2, ePeak - sPeak, 4,
                                tg->track, itemBuf, statusBuf, NULL, TRUE, NULL);
 
             // map boxes on verticals
             if (sOnScreen)
                 mapBoxHgcOrHgGene(hvg, s, e, sx - 2, yOff, 4, peak - yOff,
                                        tg->track, itemBuf, statusBuf, NULL, TRUE, NULL);
             if (eOnScreen)
                 mapBoxHgcOrHgGene(hvg, s, e, ex - 2, yOff, 4, peak - yOff,
                                        tg->track, itemBuf, statusBuf, NULL, TRUE, NULL);
             }
         }