src/hg/instinct/hgHeatmap2/hgAnnotations.c 1.13

1.13 2009/09/02 21:50:57 jsanborn
added tick marks
Index: src/hg/instinct/hgHeatmap2/hgAnnotations.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/hgHeatmap2/hgAnnotations.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -b -B -U 4 -r1.12 -r1.13
--- src/hg/instinct/hgHeatmap2/hgAnnotations.c	2 Sep 2009 17:43:12 -0000	1.12
+++ src/hg/instinct/hgHeatmap2/hgAnnotations.c	2 Sep 2009 21:50:57 -0000	1.13
@@ -652,8 +652,9 @@
     return;
 
 int width = hgHeatmapDefaultPixWidth;
 int labelHeight = hlList->height;
+int tickHeight = 10;
 
 boolean drawGeneLabels = TRUE;
 if (labelHeight == hgHeatmapDefaultLabelHeight)
     drawGeneLabels = FALSE;
@@ -676,9 +677,9 @@
     vgBox(vg, rightX, 0, 1, labelHeight, MG_GRAY);
 
     /* Draw geneset label, currently only horizontally, with name cut-off
      * if there's not enough room */
-    vgSetClip(vg, leftX, 0, gsWidth, labelHeight);
+    vgSetClip(vg, leftX, 0, gsWidth+1, labelHeight);
     
     if (drawGeneLabels)
 	{
 	struct hmElement *hEl;
@@ -687,11 +688,19 @@
 	    int gWidth = hEl->pixelEnd - hEl->pixelStart;
 	    if (gWidth < hlList->fontHeight)
 		break;  // not enough horizontal space to draw gene name vertically, leave blank.
 	    
-	    verticalTextRight(vg, hEl->pixelStart+1, -5, gWidth-2,
+	    verticalTextRight(vg, hEl->pixelStart+1, -5, gWidth-1,
 			      labelHeight - hlList->fontHeight, MG_BLACK,
 			      hlList->font, hEl->name);
+	    
+	    if (gWidth < hlList->fontHeight + 2)
+		continue;  // draw tick marks when there's enough room
+
+	    int tickX = hEl->pixelStart-1;
+	    if (tickX < 0)
+		tickX = 0;
+	    vgBox(vg, tickX, 0, 1, tickHeight, MG_GRAY);
 	    }
 	}
 
     int strWidth = mgFontStringWidth(hl->font, hl->name);