c95f690cd307e4d9447cfdeb337c4cc81d21f8aa angie Wed Apr 27 11:53:56 2016 -0700 When building list of active genomes and taxIds, join with defaultDb to avoid trouble with same species, different taxId (e.g. species vs. subspecies taxId in sacCer2 vs sacCer3). refs #15277 diff --git src/hg/hgGateway/hgGateway.c src/hg/hgGateway/hgGateway.c index 938787e..de34506 100644 --- src/hg/hgGateway/hgGateway.c +++ src/hg/hgGateway/hgGateway.c @@ -237,31 +237,36 @@ struct cartJson *cj = cartJsonNew(cart); cartJsonRegisterHandler(cj, "setTaxId", setTaxId); cartJsonRegisterHandler(cj, "setDb", setDb); cartJsonRegisterHandler(cj, "setHubDb", setHubDb); 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(); -char *query = NOSQLINJ "select distinct(genome),taxId from dbDb where active=1 " +// 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 " + "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])); 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