src/hg/hgTracks/cds.c 1.98

1.98 2009/05/29 19:22:45 mikep
choose a contrasting color for tick marks when drawgin differnt bases
Index: src/hg/hgTracks/cds.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/cds.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -b -B -U 4 -r1.97 -r1.98
--- src/hg/hgTracks/cds.c	27 May 2009 23:45:41 -0000	1.97
+++ src/hg/hgTracks/cds.c	29 May 2009 19:22:45 -0000	1.98
@@ -276,8 +276,16 @@
  * zoomedToBaseLevel, we're not in dense mode etc. */
 {
 struct simpleFeature *sf = NULL;
 char *winDna = getCachedDna(winStart, winEnd);
+Color c = cdsColor[CDS_STOP];
+// check if we need a contrasting color instead of default 'red' (CDS_STOP)
+char *tickColor = NULL;
+if ( tg->itemColor && (tickColor = trackDbSetting(tg->tdb, "baseColorTickColor")) && sameString(tickColor, "contrastingColor"))
+    {
+    Color ci = tg->itemColor(tg, lf, hvg);
+    c = hvGfxContrastingColor(hvg, ci);
+    }
 for (sf = lf->components; sf != NULL; sf = sf->next)
     {
     int s = max(winStart, sf->start);
     int e = min(winEnd, sf->end);
@@ -295,12 +303,9 @@
 	    int i;
 	    for (i=0; i < (e - s); i++)
 		{
 		if (mrnaSeq->dna[mrnaS+i] != winDna[s-winStart+i])
-		    {
-		    drawVertLine(lf, hvg, s+i, xOff, y+1, heightPer-2, scale,
-				 cdsColor[CDS_STOP]);
-		    }
+		    drawVertLine(lf, hvg, s+i, xOff, y+1, heightPer-2, scale, c);
 		}
 	    }
 	}
     }