06924c7039d792e0593d5cc9f6abdae7da3e4d0c
kate
  Tue Mar 8 17:44:17 2016 -0800
1. Use max median score from gtexInfo table for max viewlimits guidance. 2. Fix placement of gender labels. refs #15645

diff --git src/hg/lib/gtexUi.c src/hg/lib/gtexUi.c
index 092f94e..f170f0b 100644
--- src/hg/lib/gtexUi.c
+++ src/hg/lib/gtexUi.c
@@ -1,26 +1,27 @@
 /* GTEx (Genotype Tissue Expression) track controls */
 
 /* Copyright (C) 2015 The Regents of the University of California 
  * See README in this or parent directory for licensing information. */
 
 #include "cheapcgi.h"
 #include "cart.h"
 #include "hui.h"
 #include "trackDb.h"
 #include "jsHelper.h"
 #include "gtexTissue.h"
+#include "gtexInfo.h"
 #include "gtexUi.h"
 
 #define SYSTEM_BRAIN            "Brain"
 #define SYSTEM_REPRODUCTIVE     "Reproductive"
 #define SYSTEM_GASTRO           "Digestive"
 
 #define SYSTEM_ENDOCRINE        "Endocrine"
 #define SYSTEM_CARDIO           "Cardiovascular"
 #define SYSTEM_OTHER            "Other"
 
 
 /* Restrict features on right-click (popup) version */
 static boolean isPopup = FALSE;
 
 /* Convenience functions for tissue filter controls */
@@ -290,34 +291,34 @@
 char *selected = NULL;
 char buf[512];
 
 /* Data transform. When selected, the next control (view limits max) is disabled */
 printf("<div><b>Log10 transform:</b>\n");
 safef(cartVar, sizeof(cartVar), "%s.%s", track, GTEX_LOG_TRANSFORM);
 boolean isLogTransform = cartCgiUsualBoolean(cart, cartVar, GTEX_LOG_TRANSFORM_DEFAULT);
 safef(buf, sizeof buf, "onchange='gtexTransformChanged(\"%s\")'", track);
 cgiMakeCheckBoxJS(cartVar, isLogTransform, buf);
 
 /* Viewing limits max.  This control is disabled if log transform is selected */
 // construct class so JS can toggle
 safef(buf, sizeof buf, "%sViewLimitsMaxLabel %s", track, isLogTransform ? "disabled" : "");
 printf("&nbsp;&nbsp;<span class='%s'><b>View limits maximum:</b></span>\n", buf);
 safef(cartVar, sizeof(cartVar), "%s.%s", track, GTEX_MAX_LIMIT);
-// TODO: set max from gtexInfo table
 int viewMax = cartCgiUsualInt(cart, cartVar, GTEX_MAX_LIMIT_DEFAULT);
 cgiMakeIntVarWithExtra(cartVar, viewMax, 4, isLogTransform ? "disabled" : "");
-printf("<span class='%s'>  RPKM (range 10-180000)</span>\n", buf);
+char *version = gtexVersion(tdb->table);
+printf("<span class='%s'>  RPKM (range 0-%d)</span>\n", buf, round(gtexMaxMedianScore(version)));
 printf("</div>");
 
 /* Sample selection */
 printf("<div><b>Samples:</b>&nbsp;");
 safef(cartVar, sizeof(cartVar), "%s.%s", track, GTEX_SAMPLES);
 selected = cartCgiUsualString(cart, cartVar, GTEX_SAMPLES_DEFAULT); 
 boolean isAllSamples = sameString(selected, GTEX_SAMPLES_ALL);
 safef(buf, sizeof buf, "onchange='gtexSamplesChanged(\"%s\")'", track);
 char *command = buf;
 cgiMakeOnClickRadioButton(cartVar, GTEX_SAMPLES_ALL, isAllSamples, command);
 printf("All\n");
 cgiMakeOnClickRadioButton(cartVar, GTEX_SAMPLES_COMPARE_SEX, !isAllSamples, command);
 printf("Compare by gender\n");
 printf("</div>");