13827887c45cb6ba7da05276cf0c703ec7627c17
angie
  Tue Sep 25 13:29:25 2018 -0700
Add 'show this sequence placed on its chromosome' link to fixLocations in addition to altLocations, and chop ':start-end' from item names to get just the sequence name for singleAltHaplo mode. refs #18854

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 42c61c1..8bbdee4 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -4290,34 +4290,44 @@
     }
 if (imagePath)
     {
     char *bigImagePath = trackDbSettingClosestToHome(tdb, ITEM_BIG_IMAGE_PATH);
     char *bothWords[2];
     int shouldBeTwo = chopLine(imagePath, bothWords);
     if (shouldBeTwo != 2)
 	errAbort("itemImagePath setting for %s track incorrect. Needs to be \"itemImagePath <path> <suffix>\".", tdb->track);
     printf("<BR><IMG SRC=\"%s/%s.%s\"><BR><BR>\n", bothWords[0], item, bothWords[1]);
     shouldBeTwo = chopLine(bigImagePath, bothWords);
     if (shouldBeTwo != 2)
 	errAbort("bigItemImagePath setting for %s track incorrect. Needs to be \"itemImagePath <path> <suffix>\".", tdb->track);
     printf("<A HREF=\"%s/%s.%s\">Download Original Image</A><BR>\n", bothWords[0], item, bothWords[1]);
     }
 
-if (sameString(tdb->table,"altLocations") && (!strchr(item,':')))
-    {
+if ((sameString(tdb->table,"altLocations") || sameString(tdb->table,"fixLocations")) &&
+    strchr(item,'_'))
+    {
+    // Truncate item (alt/fix sequence name) at colon if found:
+    char itemCpy[strlen(item)+1];
+    safecpy(itemCpy, sizeof(itemCpy), item);
+    char *p = strchr(itemCpy, ':');
+    if (p)
+        *p = '\0';
     char *hgsid = cartSessionId(cart);
-    printf("<A HREF=\"/cgi-bin/hgTracks?hgsid=%s&virtModeType=singleAltHaplo&singleAltHaploId=%s\">Show this alternate haplotype placed on its chromosome</A><BR>\n", hgsid, item);
+    char *desc = sameString(tdb->table, "altLocations") ? "alternate haplotype" : "fix patch";
+    printf("<A HREF=\"/cgi-bin/hgTracks?hgsid=%s&virtModeType=singleAltHaplo&singleAltHaploId=%s\">"
+           "Show this %s placed on its chromosome</A><BR>\n",
+           hgsid, itemCpy, desc);
     }
 
 printTrackHtml(tdb);
 freez(&dupe);
 hFreeConn(&conn);
 }
 
 void genericClickHandler(struct trackDb *tdb, char *item, char *itemForUrl)
 /* Put up generic track info */
 {
 #ifdef OLD /* Called now by cartWebStart... */
 jsIncludeFile("jquery.js", NULL);
 jsIncludeFile("utils.js",NULL);
 #endif /* OLD */
 genericClickHandlerPlus(tdb, item, itemForUrl, NULL);