src/hg/hgTracks/factorSource.c 1.6

1.6 2010/05/07 05:07:57 kent
Code to get container multiWig to go.
Index: src/hg/hgTracks/factorSource.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/factorSource.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -b -B -U 4 -r1.5 -r1.6
--- src/hg/hgTracks/factorSource.c	3 Sep 2008 19:19:02 -0000	1.5
+++ src/hg/hgTracks/factorSource.c	7 May 2010 05:07:57 -0000	1.6
@@ -32,10 +32,22 @@
 	struct hvGfx *hvg, int xOff, int y, 
 	double scale, MgFont *font, Color color, enum trackVisibility vis)
 /* Draw factorSource item at a particular position. */
 {
-/* Calculate position, and draw box around where we are. */
+/* Figure out maximum score and draw box based on it. */
+int i;
 struct bed *bed = item;
+double maxScore = 0.0;
+for (i=0; i<track->sourceCount; ++i)
+    {
+    float score = bed->expScores[i];
+    if (score > maxScore)
+        maxScore = score;
+    }
+int grayIx = grayInRange(bed->score, 0, 1000);
+color = shadesOfGray[grayIx];
+
+/* Calculate position, and draw box around where we are. */
 int heightPer = track->heightPer;
 int x1 = round((double)((int)bed->chromStart-winStart)*scale) + xOff;
 int x2 = round((double)((int)bed->chromEnd-winStart)*scale) + xOff;
 int w = x2-x1;
@@ -54,9 +66,9 @@
 	int w = mgFontStringWidth(font, label);
 	float score = bed->expScores[i];
 	if (score > 0.0)
 	    {
-	    int grayIx = grayInRange(score*100, 0, 100);
+	    int grayIx = grayInRange(score, 0, 1000);
 	    int color = shadesOfGray[grayIx];
 	    hvGfxTextCentered(hvg, x, y, w, heightPer, color, font, label);
 	    x += mgFontStringWidth(font, label);
 	    }