0842d0243de1cbe7e9d579e3792b92e3b6a552ab
kate
  Mon Aug 3 23:16:48 2015 -0700
Fix a few bugs - connection handling, bin field in genePred, more color handling - introduced while messing with schemas (to extend features and improve perf). refs #15645

diff --git src/hg/lib/gtexTissue.c src/hg/lib/gtexTissue.c
index b7a2dd5..5c71d80 100644
--- src/hg/lib/gtexTissue.c
+++ src/hg/lib/gtexTissue.c
@@ -1,23 +1,24 @@
 /* gtexTissue.c was originally generated by the autoSql program, which also 
  * generated gtexTissue.h and gtexTissue.sql.  This module links the database and
  * the RAM representation of objects. */
 
 #include "common.h"
 #include "linefile.h"
 #include "dystring.h"
 #include "jksql.h"
+#include "hdb.h"
 #include "gtexTissue.h"
 
 
 
 char *gtexTissueCommaSepFieldNames = "id,name,description,organ,color";
 
 void gtexTissueStaticLoad(char **row, struct gtexTissue *ret)
 /* Load a row from gtexTissue table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->id = sqlUnsigned(row[0]);
 ret->name = row[1];
 ret->description = row[2];
 ret->organ = row[3];
@@ -176,23 +177,41 @@
 fputc(lastSep,f);
 }
 
 /* -------------------------------- End autoSql Generated Code -------------------------------- */
 void gtexTissueCreateTable(struct sqlConnection *conn, char *table)
 /* Create expression record format table of given name. */
 {
 char query[1024];
 
 sqlSafef(query, sizeof(query),
 "CREATE TABLE %s (\n"
 "    id int unsigned not null, # internal id\n"
 "    name varchar(255) not null,       # short UCSC identifier\n"
 "    description varchar(255) not null, # GTEx tissue type detail\n"
 "    organ varchar(255) not null,      # GTEx tissue collection area\n"
+"    color int unsigned not null,      # GTEx assigned color\n"
 "              #Indices\n"
 "    PRIMARY KEY(id)\n"
 ")\n",   table);
 sqlRemakeTable(conn, table, query);
 }
 
+struct gtexTissue *gtexGetTissues()
+/* Get tissue id, descriptions, colors, etc. */
+{
+char query[1024];
+struct sqlConnection *conn = hAllocConn("hgFixed");
+sqlSafef(query, sizeof(query), "select * from gtexTissue order by id");
+struct gtexTissue *gtexTissues = gtexTissueLoadByQuery(conn, query);
+hFreeConn(&conn);
+return gtexTissues;
+}
 
+struct rgbColor gtexTissueBrightenColor(struct rgbColor rgb)
+/* Increase brightness for better visibility of small items */
+{
+struct hslColor hsl = mgRgbToHsl(rgb);
+hsl.s = min(1000, hsl.s + 300);
+return mgHslToRgb(hsl);
+}