Index: src/hg/hgTracks/simpleTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/simpleTracks.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -b -B -U 4 -r1.66 -r1.67
--- src/hg/hgTracks/simpleTracks.c	3 Mar 2009 20:49:49 -0000	1.66
+++ src/hg/hgTracks/simpleTracks.c	3 Mar 2009 21:17:17 -0000	1.67
@@ -4891,10 +4891,8 @@
 else if (tg->colorShades)
     {
     int scoreMin = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMin", "0"));
     int scoreMax = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMax", "1000"));
-    scoreMin = cartUsualIntClosestToHome(cart,tdb, FALSE, "scoreMin", scoreMin);
-    scoreMax = cartUsualIntClosestToHome(cart,tdb, FALSE, "scoreMax", scoreMax);
     color = tg->colorShades[grayInRange(bed->score, scoreMin, scoreMax)];
     }
 if (color)
     {
@@ -5802,9 +5800,10 @@
 
 if (tdb->tableName != prevTrackName)
     {
     scoreMinGrayLevel = scoreMin * maxShade/scoreMax;
-    if (scoreMinGrayLevel <= 0) scoreMinGrayLevel = 1;
+    if (scoreMinGrayLevel <= 0)
+        scoreMinGrayLevel = 1;
     cartMinGrayLevel = cartUsualIntClosestToHome(cart, tdb, FALSE, "minGrayLevel", scoreMinGrayLevel);
     newScoreMin = cartMinGrayLevel * scoreMax/maxShade;
     prevTrackName = tdb->tableName;
     }
@@ -5812,8 +5811,13 @@
     {
     float realScore = (float)(bed->score - scoreMin) / (scoreMax - scoreMin);
     bed->score = newScoreMin + (realScore * (scoreMax - newScoreMin)) + 0.5;
     }
+else if(scoreMin != 0 && scoreMax == 1000) // Changes gray level even when UI does not allow selecting it.
+    {
+    float realScore = (float)(bed->score) / 1000;
+    bed->score = scoreMin + (realScore * (scoreMax - scoreMin)) + 0.5;
+    }
 }
 
 void bedLoadItemByQuery(struct track *tg, char *table,
 			char *query, ItemLoader loader)
@@ -5862,10 +5866,8 @@
 int w;
 struct trackDb *tdb = tg->tdb;
 int scoreMin = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMin", "0"));
 int scoreMax = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMax", "1000"));
-scoreMin = cartUsualIntClosestToHome(cart,tdb, FALSE, "scoreMin", scoreMin);
-scoreMax = cartUsualIntClosestToHome(cart,tdb, FALSE, "scoreMax", scoreMax);
 char *directUrl = trackDbSetting(tdb, "directUrl");
 boolean withHgsid = (trackDbSetting(tdb, "hgsid") != NULL);
 //boolean thickDrawItem = (trackDbSetting(tdb, "thickDrawItem") != NULL);
 int colors[8] =
@@ -9224,10 +9226,8 @@
 int y2 = y + tg->heightPer-1;
 struct trackDb *tdb = tg->tdb;
 int scoreMin = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMin", "0"));
 int scoreMax = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMax", "1000"));
-scoreMin = cartUsualIntClosestToHome(cart,tdb, FALSE, "scoreMin", scoreMin);
-scoreMax = cartUsualIntClosestToHome(cart,tdb, FALSE, "scoreMax", scoreMax);
 
 if (tg->itemColor != NULL)
     color = tg->itemColor(tg, bed, hvg);
 else
@@ -10086,10 +10086,8 @@
 {
 struct linkedFeatures *list = NULL;
 int scoreMin = atoi(trackDbSettingClosestToHomeOrDefault(tg->tdb, "scoreMin", "0"));
 int scoreMax = atoi(trackDbSettingClosestToHomeOrDefault(tg->tdb, "scoreMax", "1000"));
-scoreMin = cartUsualIntClosestToHome(cart,tg->tdb, FALSE, "scoreMin", scoreMin);
-scoreMax = cartUsualIntClosestToHome(cart,tg->tdb, FALSE, "scoreMax", scoreMax);
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr = NULL;
 char **row = NULL;
 int rowOffset = 0;

