d3c4dd4f1df4b3919520794bfcaac0a7d0935a7f
angie
  Tue Dec 19 12:07:23 2017 -0800
Replace hgTracks' links to NCBI's obsolete Map Viewer with the new & improved Genome Data Viewer.  GDV has only the latest RefSeq assembly for all species except human; it wants GCF_... IDs, which we will have to keep updating in hdb.c.  It's possible that someday NCBI may accept our db IDs instead of GCF_.  refs #18671

diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c
index 807d17a..6b38607 100644
--- src/hg/lib/hdb.c
+++ src/hg/lib/hdb.c
@@ -567,30 +567,69 @@
     }
 return hel->val;
 }
 
 int hChromCount(char *db)
 /* Return the number of chromosomes (scaffolds etc.) in the given db. */
 {
 if (trackHubDatabase(db))
     return trackHubChromCount(db);
 struct sqlConnection *conn = hAllocConn(db);
 int count = sqlQuickNum(conn, NOSQLINJ "select count(*) from chromInfo");
 hFreeConn(&conn);
 return count;
 }
 
+// This maps db names to the latest NCBI RefSeq assembly+annotation GCF_ IDs as of
+// 12/19/2017.
+struct dbToGcf
+    {
+    char *db;
+    char *gcf;
+    };
+static struct dbToGcf dbToGcf[] =
+    {
+    { "hg38", "GCF_000001405.37" },
+    { "hg19", "GCF_000001405.25" },
+    { "mm10", "GCF_000001635.26" },
+    { "danRer11", "GCF_000002035.6" },
+    { "galGal5", "GCF_000002315.4" },
+    { "canFam3", "GCF_000002285.3" },
+    { "rheMac8", "GCF_000772875.2" },
+    { "panTro5", "GCF_000001515.7" },
+    { "bosTau8", "GCF_000003055.6" },
+    { "rn6", "GCF_000001895.5" },
+    { "xenTro9", "GCF_000004195.3" },
+    { "susScr11", "GCF_000003025.6" },
+    { "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;
+        }
+return gcf;
+}
+
 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. */
 {
 if (hdbCc == NULL)
     hdbCc = sqlConnCacheNew();
 return sqlConnCacheMayAlloc(hdbCc, db);