98874f1656202cd5781466a5d9b25f47da1f104d
hiram
  Mon Feb 13 16:03:53 2023 -0800
a bit closer to correct NCBI links, not perfect, but better than it was no redmine

diff --git src/hg/hgTracks/menu.c src/hg/hgTracks/menu.c
index 8bd29ae..979bf17 100644
--- src/hg/hgTracks/menu.c
+++ src/hg/hgTracks/menu.c
@@ -6,30 +6,31 @@
 #include "common.h"
 #include "dystring.h"
 #include "ensFace.h"
 #include "agpFrag.h"
 #include "ctgPos.h"
 #include "hCommon.h"
 #include "htmshell.h"
 #include "hash.h"
 #include "wikiLink.h"
 #include "web.h"
 #include "geoMirror.h"
 #include "hgTracks.h"
 #include "trackHub.h"
 #include "extTools.h"
 #include "trackVersion.h"
+#include "chromAlias.h"
 
 /* list of links to display in a menu */
 /* a link with an empty name is displayed as a horizontal separator line */
 struct hotLink
     {
     struct hotLink *next;
     char *name;
     char *url;
     char *id;
     char *mouseOver;
     char *onClick;
     char *shortcut;
     boolean inactive; /* greyed out */
     boolean external;
     };
@@ -334,37 +335,48 @@
                         printEnsemblAnchor(database, archive, ctgItem->contig,
                                            ctgStart, ctgEnd, &links);
                         }
                     }
                 ctgPosFree(&ctgItem);   // the one we maybe used
                 }
             }
         else
             {
             printEnsemblAnchor(database, archive, chromName, winStart, winEnd, &links);
             }
         }
     }
 hFreeConn(&conn);
 
+char *gcfId = hNcbiGcfId(database);
 char *gcaId = hNcbiGcaId(database);
-if (isNotEmpty(gcaId))
+if (isNotEmpty(gcfId))	/* GCF has priority over GCA */
     {
+    char *ncbiChr = chromAliasNCBI(database, chromName, gcfId);
     safef(buf, sizeof(buf),
           "https://www.ncbi.nlm.nih.gov/genome/gdv/browser/"
           "?context=genome&acc=%s&chr=%s&from=%d&to=%d",
-          gcaId, skipChr(chromName), winStart+1, winEnd);
+          gcfId, ncbiChr, winStart+1, winEnd);
+    appendLink(&links, buf, "NCBI", "ncbiLink", TRUE);
+    }
+else if (isNotEmpty(gcaId))
+    {
+    char *ncbiChr = chromAliasNCBI(database, chromName, gcaId);
+    safef(buf, sizeof(buf),
+          "https://www.ncbi.nlm.nih.gov/genome/gdv/browser/"
+          "?context=genome&acc=%s&chr=%s&from=%d&to=%d",
+          gcaId, ncbiChr, winStart+1, winEnd);
     appendLink(&links, buf, "NCBI", "ncbiLink", TRUE);
     }
 else if (startsWith("oryLat", database))
     {
     safef(buf, sizeof(buf), "http://medaka.utgenome.org/browser_ens_jump.php?revision=version1.0&chr=chromosome%s&start=%d&end=%d",
           skipChr(chromName), winStart+1, winEnd);
     appendLink(&links, buf, "UTGB", "medakaLink", TRUE);
     }
 else if (sameString(database, "cb3"))
     {
     safef(buf, sizeof(buf), "http://www.wormbase.org/db/seq/gbrowse/briggsae?name=%s:%d-%d",
           skipChr(chromName), winStart+1, winEnd);
     appendLink(&links, buf, "WormBase", "wormbaseLink", TRUE);
     }
 else if (sameString(database, "cb4"))