6b833bddf059affee05eb0ddb1b2d4e06554ca6b
jcasper
  Thu Mar 23 14:28:05 2017 -0700
DECIPHER track now displays correct mean ratio and pathogenicity, refs #19129

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index df90ace..6604397 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -10072,38 +10072,44 @@
 /* Print details of a DECIPHER entry. */
 {
 struct sqlConnection *conn = hAllocConn(database);
 char query[256];
 struct sqlResult *sr;
 char **row;
 struct sqlConnection *conn2 = hAllocConn(database);
 char query2[256];
 struct sqlResult *sr2;
 char **row2;
 char *strand={"+"};
 int start = cartInt(cart, "o");
 int end = cartInt(cart, "t");
 char *chrom = cartString(cart, "c");
 
+/* So far, we can just remove "chr" from UCSC chrom names to get DECIPHER names */
+char *decipherChrom = chrom;
+if (startsWithNoCase("chr", decipherChrom))
+    decipherChrom += 3;
+
 printf("<H3>Patient %s </H3>", itemName);
 
 /* print phenotypes and other information, if available */
 if (sqlFieldIndex(conn, "decipherRaw", "phenotypes") >= 0)
     {
     sqlSafef(query, sizeof(query),
         "select phenotypes, mean_ratio, inheritance, pathogenicity, contribution "
-        "from decipherRaw where id = '%s'", itemName);
+        "from decipherRaw where id = '%s' and chr = '%s' and start = %d and end = %d",
+        itemName, decipherChrom, start+1, end);
     sr = sqlMustGetResult(conn, query);
     row = sqlNextRow(sr);
     if ((row != NULL) && strlen(row[0]) >= 1)
         {
         char *phenoString = replaceChars(row[0], "|", "</li>\n<li>");
         printf("<b>Phenotypes:</b>\n<ul>\n"
                "<li>%s</li>\n"
                "</ul>\n", phenoString);
         // freeMem(phenoString);
         }
     if (row != NULL)
         {
         if (isNotEmpty(row[1]))
             {
             printf("<b>Mean Ratio:</b> %s\n<br>\n", row[1]);