b46d372807d2ffc6fd3d03ec2ad71dd72a361672
kate
  Thu Apr 28 11:15:14 2016 -0700
Refactor GTEx boxplot code in preparation for moving to library for shared use with hgGene

diff --git src/hg/lib/gtexInfo.c src/hg/lib/gtexInfo.c
index 517e3d6..951c626 100644
--- src/hg/lib/gtexInfo.c
+++ src/hg/lib/gtexInfo.c
@@ -186,37 +186,42 @@
 "        #Indices\n"
 "    PRIMARY KEY(version)\n"
 ")\n",   table);
 sqlRemakeTable(conn, table, query);
 }
 
 char *gtexVersionSuffix(char *table)
 /* Return version string for a GTEx track table.  For now, just supporting V4 and V6 (default, no suffix )*/                                        
 {
 if (endsWith(table, "V4"))
     return("V4");
 return("");
 }
 
 char *gtexVersion(char *table)
-/* Return version string based on table suffix */
+/* Return version string based on table suffix. Default version tables have no suffix */
 {
 char *suffix = gtexVersionSuffix(table);
-// Currently the V4 tables have no suffix
 return (sameString(suffix, "")) ? GTEX_DEFAULT_VERSION : suffix;
 }
 
+char *gtexVersionSuffixFromVersion(char *version)
+/* Return version table suffix for a version */
+{
+return (sameString(version, GTEX_DEFAULT_VERSION)) ? "" : version;
+}
+
 double gtexMaxMedianScore(char *version)
 /* Retrieve max median score for latest (or named) version */
 {
 char query[1024];
 struct sqlConnection *conn = hAllocConn("hgFixed");
 if (!conn)
     return 0;
 // TODO: trackDB setting for this
 if (!version || sameString(version, ""))
     version = GTEX_DEFAULT_VERSION;
 sqlSafef(query, sizeof query, "select maxMedianScore from gtexInfo where version='%s'", version);
 double score = sqlQuickDouble(conn, query);
 if (score == 0.0)
     errAbort("Internal error: GTEx version \"%s\" not found in gtexInfo table", version);
 hFreeConn(&conn);