69b427307c0ec0dcda1782182aae4b46ac50fb8e angie Mon Jun 6 10:31:34 2016 -0700 Check database existence instead of just relying on dbDb.active because GBiB/GBiC may copy our dbDb, but have a limited set of species locally. fixes #17316 diff --git src/hg/hgGateway/hgGateway.c src/hg/hgGateway/hgGateway.c index 195bc71..3b42f50 100644 --- src/hg/hgGateway/hgGateway.c +++ src/hg/hgGateway/hgGateway.c @@ -242,37 +242,42 @@ cartJsonRegisterHandler(cj, "getUiState", getUiState); cartJsonExecute(cj); } static void printActiveGenomes() /* Print out JSON for an object mapping each genome that has at least one db with active=1 * to its taxId. */ { struct jsonWrite *jw = jsonWriteNew(); jsonWriteObjectStart(jw, NULL); struct sqlConnection *conn = hConnectCentral(); // Join with defaultDb because in rare cases, different taxIds (species vs. subspecies) // may be used for different assemblies of the same species. Using defaultDb means that // we send a taxId consistent with the taxId of the assembly that we'll change to when // the species is selected from the tree. -char *query = NOSQLINJ "select dbDb.genome, taxId from dbDb, defaultDb " +char *query = NOSQLINJ "select dbDb.genome, taxId, dbDb.name from dbDb, defaultDb " "where defaultDb.name = dbDb.name and active = 1 " "and taxId > 1;"; // filter out experimental hgwdev-only stuff with invalid taxIds struct sqlResult *sr = sqlGetResult(conn, query); char **row; while ((row = sqlNextRow(sr)) != NULL) - jsonWriteNumber(jw, row[0], atoi(row[1])); + { + char *genome = row[0], *db = row[2]; + int taxId = atoi(row[1]); + if (hDbExists(db)) + jsonWriteNumber(jw, genome, taxId); + } hDisconnectCentral(&conn); jsonWriteObjectEnd(jw); puts(jw->dy->string); jsonWriteFree(&jw); } static void doMainPage() /* Send HTML with javascript to bootstrap the user interface. */ { // Start web page with new banner char *db = NULL, *genome = NULL, *clade = NULL; getDbGenomeClade(cart, &db, &genome, &clade, oldVars); // If CGI has &lastDbPos=..., handle that here and save position to cart so it's in place for // future cartJson calls. char *position = cartGetPosition(cart, db, NULL);