2d9d194b4bb0e2ec25ca1d45739fdd418632dbb8
lrnassar
  Wed Jul 8 13:53:54 2026 -0700
Add db= to same-CGI self-links in hgTrackUi and hgc. refs #37840

Extends #37840 to same-CGI links that omitted db= and relied on the cart db,
which still broke as shared, bookmarked, or search-indexed URLs. In hgTrackUi
adds db to the superTrack member list, container-configure, description,
sibling-track, duplicate/unduplicate, and quickLift-remove links. In hgc adds
the current assembly's db to the shared anchor helpers (hgcAnchorSomewhereExt,
hgcAnchorPosition, hgcAnchorWindow, hgcAnchorTranslatedChain,
hgcAnchorPseudoGene), covering all their callers, plus the getDna, htcExtSeq,
refGene, stsMap, cutter, cgapSage, mgc, peakClusters, regMotif, and pubs links.
The foreign-assembly variant hgcAnchorSomewhereDb and the db2=/qlSourceDb=
params are left untouched.

diff --git src/hg/hgc/cgapSageClick.c src/hg/hgc/cgapSageClick.c
index 53f79f50773..f7d1e456ddd 100644
--- src/hg/hgc/cgapSageClick.c
+++ src/hg/hgc/cgapSageClick.c
@@ -128,49 +128,49 @@
 
 static void tagTableRow(struct cgapSage *tag, unsigned libId, 
         unsigned freq, double tagTpm, 
 	struct hash *libHash, char *clickedLibId, char *clickedTissue) 
 /* Print one of the rows in the tag information section table.  */
 {
 struct cgapSageLib *lib;
 char s[256];
 safef(s, sizeof(s), "%d", libId);
 lib = (struct cgapSageLib *)hashFindVal(libHash, s);
 if ((clickedLibId && sameString(s, clickedLibId)) ||
     (clickedTissue && sameString(clickedTissue, lib->tissue)))
     {
     safef(s, sizeof(s), "<B>%d</B>", libId);
     webPrintLinkCell(s);
-    safef(s, sizeof(s), "<A HREF=\"%s&o=%d&t=%d&c=%s&g=cgapSage&i=%s&lib=%d\"><B>%s</B></A>", 
-	  hgcPathAndSettings(), tag->chromStart, tag->chromEnd, tag->chrom, tag->name, libId,
+    safef(s, sizeof(s), "<A HREF=\"%s&db=%s&o=%d&t=%d&c=%s&g=cgapSage&i=%s&lib=%d\"><B>%s</B></A>", 
+	  hgcPathAndSettings(), database, tag->chromStart, tag->chromEnd, tag->chrom, tag->name, libId,
 	  lib->newLibName);
     webPrintLinkCell(s);
     safef(s, sizeof(s), "<B>%s</B>", lib->tissue);
     webPrintLinkCell(s);
     safef(s, sizeof(s), "<B>%d</B>", freq);
     webPrintLinkCell(s);
     safef(s, sizeof(s), "<B>%d</B>", lib->totalTags);
     webPrintLinkCell(s);
     safef(s, sizeof(s), "<B>%.3f</B>", tagTpm);
     webPrintLinkCell(s);
     }
 else
     {
     safef(s, sizeof(s), "%d", libId);
     webPrintLinkCell(s);  
-    safef(s, sizeof(s), "<A HREF=\"%s&o=%d&t=%d&c=%s&g=cgapSage&i=%s&lib=%d\">%s</A>", hgcPathAndSettings(), 
-	  tag->chromStart, tag->chromEnd, tag->chrom, tag->name, libId,
+    safef(s, sizeof(s), "<A HREF=\"%s&db=%s&o=%d&t=%d&c=%s&g=cgapSage&i=%s&lib=%d\">%s</A>", hgcPathAndSettings(), 
+	  database, tag->chromStart, tag->chromEnd, tag->chrom, tag->name, libId,
 	  lib->newLibName);
     webPrintLinkCell(s);
     webPrintLinkCell(lib->tissue);
     safef(s, sizeof(s), "%d", freq);
     webPrintLinkCell(s);
     safef(s, sizeof(s), "%d", lib->totalTags);
     webPrintLinkCell(s);
     safef(s, sizeof(s), "%.3f", tagTpm);
     webPrintLinkCell(s);
     }
 }
 
 static void printCgapTagSection(struct cgapSage *tag, struct hash *libHash)
 /* Print section with frequency and TPM info for all the libs with the tag. */
 {