d89c874346552fbb921d6a1d038a79605f6ce613
jcasper
  Wed Jul 13 11:45:07 2016 -0700
DECIPHER pipeline now runs on their new file format. Also added more data to the hgc output.  refs #14465

diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index 9897588..28ff134 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -6444,34 +6444,57 @@
 hvGfxBox(hvg, x1, y, w, heightPer, color);
 
 if (vis == tvFull)
     {
     // New text for label in full mode:
     char *sDiseaseClasses = gadDiseaseClassList(bed->name);
     int textWidth = mgFontStringWidth(font, sDiseaseClasses);
     hvGfxTextRight(hvg, x1-textWidth-2, y, textWidth, heightPer, MG_BLACK, font, sDiseaseClasses);
     }
 }
 
 static char *decipherPhenotypeList(char *name)
 /* Return list of diseases associated with a DECIPHER entry */
 {
 char query[256];
+static char list[4096];
+struct sqlConnection *conn = hAllocConn(database);
+if (sqlFieldIndex(conn, "decipherRaw", "phenotypes") >= 0)
+    {
+    list[0] = '\0';
+    sqlSafef(query, sizeof(query),
+        "select phenotypes from decipherRaw where id='%s'", name);
+    struct sqlResult *sr = sqlMustGetResult(conn, query);
+    char **row = sqlNextRow(sr);
+    if ((row != NULL) && strlen(row[0]) >= 1)
+        {
+        char *prettyResult = replaceChars(row[0], "|", "; ");
+        safecpy(list, sizeof(list), prettyResult);
+        // freeMem(prettyResult);
+        }
+    sqlFreeResult(&sr);
+    }
+else
+    {
     sqlSafef(query, sizeof(query),
         "select distinct phenotype from decipherRaw where id='%s' order by phenotype", name);
+    hFreeConn(&conn);
     return collapseRowsFromQuery(query, "; ", 20);
     }
+hFreeConn(&conn);
+return list;
+}
 
 void decipherLoad(struct track *tg)
 /* Load DECIPHER items with extra labels from decipherPhenotypeList. */
 {
 bedPlusLabelLoad(tg, decipherPhenotypeList);
 }
 
 Color decipherColor(struct track *tg, void *item, struct hvGfx *hvg)
 /* Return color to draw DECIPHER entry */
 {
 struct bed *bed = item;
 int col = tg->ixColor;
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr;
 char **row;