8c908f948b09826c6cb4452ee5b282aca41be85e
galt
  Tue Dec 8 21:52:59 2015 -0800
Multi-region (exonMostly). This work allows people to look at virtual chromosomes from a list of regions and then navigate and perform all of the usual functions on it.

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index c72ff6f..7a68edb 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -4055,30 +4055,36 @@
     }
 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,':')))
+    {
+    char *hgsid = cartSessionId(cart);
+    printf("<A HREF=\"/cgi-bin/hgTracks?hgsid=%s&virtModeType=singleHaplo&singleHaploId=%s\">Show this alternate haplotype placed on its chromosome</A><BR>\n", hgsid, item);
+    }
+
 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);
 }
 
@@ -24564,30 +24570,55 @@
 
 
 if (hIsGisaidServer())
     {
     validateGisaidUser(cart);
     }
 
 /*	database and organism are global variables used in many places	*/
 getDbAndGenome(cart, &database, &genome, NULL);
 organism = hOrganism(database);
 scientificName = hScientificName(database);
 
 
 dbIsFound = trackHubDatabase(database) || sqlDatabaseExists(database);
 
+// Try to deal with virt chrom position used by hgTracks.
+// Hack the cart vars to set to a non virtual chrom mode position
+if (startsWith("virt:", cartUsualString(cart, "position", "")))
+    {
+    char *nvPos = cartUsualString(cart, "nonVirtPosition", "");
+    /* parse non-virtual position */
+    char *pos = cloneString(nvPos);
+    char *colon = strchr(pos, ':');
+    if (!colon)
+    errAbort("position has no colon");
+    char *dash = strchr(pos, '-');
+    if (!dash)
+    errAbort("position has no dash");
+    *colon = 0;
+    *dash = 0;
+    char *chromName = cloneString(pos);
+    int winStart = atol(colon+1) - 1;
+    int winEnd = atol(dash+1);
+    cartSetString(cart, "position", nvPos);
+    cartSetString(cart, "c", chromName);
+    cartSetInt(cart, "l", winStart);
+    cartSetInt(cart, "r", winEnd);
+    }
+
+
 if (dbIsFound)
     seqName = hgOfficialChromName(database, cartString(cart, "c"));
 else
     seqName = cartString(cart, "c");
 
 winStart = cartUsualInt(cart, "l", 0);
 winEnd = cartUsualInt(cart, "r", 0);
 
 /* Allow faked-out c=0 l=0 r=0 (e.g. for unaligned mRNAs) but not just any
  * old bogus position: */
 if (seqName == NULL)
     {
     if (winStart != 0 || winEnd != 0)
 	webAbort("CGI variable error",
 		 "hgc: bad input variables c=%s l=%d r=%d",