f3e8c2d2a50439d3def29335a814c30294b6d309
braney
  Wed Sep 9 11:31:56 2015 -0700
add ability to specify a genome within an assembly hub (no redmine)

diff --git src/hg/lib/hubConnect.c src/hg/lib/hubConnect.c
index fefd5b8..28e51c3 100644
--- src/hg/lib/hubConnect.c
+++ src/hg/lib/hubConnect.c
@@ -556,32 +556,46 @@
 
 if (url == NULL)
     return NULL;
 
 trimSpaces(url);
 
 gNewHub = hub = getAndSetHubStatus( cart, url, TRUE);
     
 cartRemove(cart, hgHubDataClearText);
 cartRemove(cart, hgHubDataText);
 
 char *wantFirstDb = cartOptionalString(cart, hgHubDoFirstDb);
 char *newDatabase = NULL;
 if ((wantFirstDb != NULL) && (hub->trackHub != NULL))
     newDatabase = hub->trackHub->defaultDb;
+else 
+    {
+    // Check to see if the user specified an assembly within
+    // an assembly hub.
+    char *assemblyDb = cartOptionalString(cart, hgHubGenome);
+    if (assemblyDb != NULL)
+        {
+        char buffer[512];
+
+        safef(buffer, sizeof buffer, "hub_%d_%s",  hub->id, assemblyDb);
+        newDatabase = cloneString(buffer);
+        }
+    }
 
 cartRemove(cart, hgHubDoFirstDb);
+cartRemove(cart, hgHubGenome);
 return newDatabase;
 }
 
 unsigned hubResetError(char *url)
 /* clear the error for this url in the hubStatus table,return the id */
 {
 struct sqlConnection *conn = hConnectCentral();
 char query[512];
 
 sqlSafef(query, sizeof(query), "select id from %s where hubUrl = \"%s\"", getHubStatusTableName(), url);
 unsigned id = sqlQuickNum(conn, query);
 
 if (id == 0)
     errAbort("could not find url %s in status table (%s)\n", 
 	url, getHubStatusTableName());