6369f96481cd1d01d031b76bbd894c24210573a7 braney Wed Jul 22 13:43:52 2026 -0700 Allow GenArk (curated hub) assemblies to be an organism's default in hDbForTaxon. Also fix the loop's break so it checks all rows, not just the first. refs #37909 diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index b182f47dc05..5872853cbbc 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -577,46 +577,50 @@ char query[256]; struct sqlConnection *centralConn = hConnectCentral(); sqlSafef(query, sizeof(query), "select f.name from %s d,%s f " "where d.scientificName='%s' " "and d.name = f.name ", dbDbTable(), defaultDbTable(), sciName); db = sqlQuickString(centralConn, query); hDisconnectCentral(¢ralConn); return db; } static char *firstExistingDbFromQuery(struct sqlConnection *conn, char *query) /* Perform query; result is a list of database names. Clone and return the first database - * that exists, or NULL if the query has no results or none of the databases exist. */ + * that exists as a real SQL database or as a curated hub (GenArk) assembly, or NULL if the + * query has no results or none of the databases exist. */ { char *db = NULL; struct slName *sl, *list = sqlQuickList(conn, query); for (sl = list; sl != NULL; sl = sl->next) { - if (sqlDatabaseExists(sl->name)) + if (sqlDatabaseExists(sl->name) || hubConnectIsCurated(sl->name)) + { db = cloneString(sl->name); break; } + } slFreeList(&list); return db; } char *hDbForTaxon(int taxon) -/* Get default database associated with NCBI taxon number, or NULL if not found. */ +/* Get default database associated with NCBI taxon number, or NULL if not found. + * The returned db may be a curated hub (GenArk) assembly rather than a real SQL database. */ { char *db = NULL; if (taxon != 0) { struct sqlConnection *centralConn = hConnectCentral(); char query[512]; // First try defaultDb. Watch out for taxIds with multiple genomes (and hence multiple // defaultDb matches). For example, 9606 (human) has patch databases, each with a different // genome. Favor the "real" genome using orderKey and make sure databases are active in dbDb. sqlSafef(query, sizeof(query), "select d.name from %s d, %s f " "where d.taxId = %d and d.name = f.name " "and active = 1 order by orderKey", dbDbTable(), defaultDbTable(), taxon); db = firstExistingDbFromQuery(centralConn, query);