67a193695c84dcb0508c79bdc7f8549471e9c5a7 hiram Fri Feb 10 12:50:06 2023 -0800 using the asmEquivalent hgFixed table to get an assembly name for the GDV browser will also need to translate the chromsome name to get this to work no redmine diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index 67240d6..f8b0436 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -37,30 +37,31 @@ #include "ctgPos.h" #include "hubConnect.h" #include "customTrack.h" #include "hgFind.h" #endif /* GBROWSE */ #include "hui.h" #include "trackHub.h" #include "net.h" #include "udc.h" #include "paraFetch.h" #include "regexHelper.h" #include "filePath.h" #include "wikiLink.h" #include "cheapcgi.h" #include "chromAlias.h" +#include "asmEquivalent.h" #ifdef LOWELAB #define DEFAULT_PROTEINS "proteins060115" #define DEFAULT_GENOME "Pyrobaculum aerophilum" #else #define DEFAULT_PROTEINS "proteins" #define DEFAULT_GENOME "Human" #endif static struct sqlConnCache *hdbCc = NULL; /* cache for primary database connection */ static struct sqlConnCache *centralCc = NULL; static char *centralDb = NULL; static struct sqlConnCache *cartCc = NULL; /* cache for cart; normally same as centralCc */ static char *cartDb = NULL; @@ -616,52 +617,56 @@ { "equCab2", "GCF_000002305.2" }, { NULL, NULL } }; char *hNcbiGcfId(char *db) /* Return the NCBI RefSeq assembly+annotations ID (GCF_...) for db, or NULL if we don't know it. */ { char *gcf = NULL; int i; for (i = 0; dbToGcf[i].db != NULL; i++) if (sameString(db, dbToGcf[i].db)) { gcf = cloneString(dbToGcf[i].gcf); break; } +if (NULL == gcf) + gcf = asmEquivalentUcscToNCBI(db); return gcf; } char *hNcbiGcaId(char *db) /* Return the NCBI GenBank assembly id (GCA_...) for db, or NULL if we don't know it. */ { char *gca = NULL; if (! trackHubDatabase(db)) { struct sqlConnection *conn = hConnectCentral(); char query[1024]; sqlSafef(query, sizeof(query), "select sourceName from dbDb where name = '%s'", db); char sourceName[2048]; sqlQuickQuery(conn, query, sourceName, sizeof(sourceName)); regmatch_t substrs[2]; if (isNotEmpty(sourceName) && regexMatchSubstr(sourceName, "GCA_[0-9]+\\.[0-9]+", substrs, ArraySize(substrs))) { gca = regexSubstringClone(sourceName, substrs[0]); } hDisconnectCentral(&conn); } +if (NULL == gca) + gca = asmEquivalentUcscToNCBI(db); return gca; } struct sqlConnection *hAllocConn(char *db) /* Get free connection if possible. If not allocate a new one. */ { if (hdbCc == NULL) hdbCc = sqlConnCacheNew(); return sqlConnCacheAlloc(hdbCc, db); } struct sqlConnection *hAllocConnMaybe(char *db) /* Get free connection if possible. If not allocate a new one. Return * NULL if db doesn't exist or can't be connected to. */ {