97b899f21a0804a3f9e025fca3e1a785db9cb6fe
braney
  Wed Oct 19 17:18:31 2022 -0700
get the clade, org, and db dropdowns in hgTables to work with curated
hubs

diff --git src/hg/hgTables/hgTables.c src/hg/hgTables/hgTables.c
index a9d79f5..d27ce21 100644
--- src/hg/hgTables/hgTables.c
+++ src/hg/hgTables/hgTables.c
@@ -1682,30 +1682,40 @@
         curTrack = tdb;
     }
 }
 
 
 void hgTables()
 /* hgTables - Get table data associated with tracks and intersect tracks.
  * Here we set up cart and some global variables, dispatch the command,
  * and put away the cart when it is done. */
 {
 
 char *clade = NULL;
 
 oldVars = hashNew(10);
 
+char *checkDb = cgiOptionalString("db");
+char *checkGenome = cgiOptionalString("org");
+
+if (checkGenome && differentString(checkGenome, "0") && checkDb && sameString(checkDb, "0"))
+    {
+    char *newDb = hDefaultDbForGenome(checkGenome);
+    if (newDb)
+        cgiChangeVar("db", newDb);
+    }
+
 /* Sometimes we output HTML and sometimes plain text; let each outputter
  * take care of headers instead of using a fixed cart*Shell(). */
 cart = cartAndCookieNoContent(hUserCookie(), excludeVars, oldVars);
 
 // Try to deal with virt chrom position used by hgTracks.
 if (startsWith(    MULTI_REGION_CHROM, cartUsualString(cart, "position", ""))
  || startsWith(OLD_MULTI_REGION_CHROM, cartUsualString(cart, "position", "")))
     cartSetString(cart, "position", cartUsualString(cart, "nonVirtPosition", ""));
 
 /* Set up global variables. */
 allJoiner = joinerRead("all.joiner");
 getDbGenomeClade(cart, &database, &genome, &clade, oldVars);
 chromAliasSetup(database);
 freezeName = hFreezeFromDb(database);