94041c12e043016875ebd340568bda0ccaf122f6 lrnassar Wed Jul 8 13:53:22 2026 -0700 Add db= to cross-CGI hgTracks/hgTrackUi/hgc links to prevent wrong-assembly errors. refs #37840 Completes the incomplete work from #26892: links from the browser to a different CGI omitted db=, so the target CGI fell back to the cart's db (often wrong), producing "Can't find <track> in track database <db>" errors and broken shared links. Adds the current-assembly db to link builders across hgTracks (chromGraphTrack, expRatioTracks, config ruler and per-track configure links, variation), hgVai, hgFileUi, hgGtexTrackSettings, hgBlat, hgGene, hgNear, the barChart/GTEx faceted UI (facetedBar, barChartUi, gtexUi), and the hgTrackUi group-configure link. diff --git src/hg/hgGene/sequence.c src/hg/hgGene/sequence.c index d8fb75fa54e..615e6dfae39 100644 --- src/hg/hgGene/sequence.c +++ src/hg/hgGene/sequence.c @@ -13,42 +13,44 @@ #include "web.h" #include "dnautil.h" #include "dbDb.h" #include "axtInfo.h" #include "obscure.h" #include "hCommon.h" #include "hgGene.h" void printPrimer3Anchor(char *table, char *itemName, char *chrom, int start, int end) /* Print primer3 sequence export anchor. */ { hPrintf("<A HREF=\"%s?%s", hgcName(), cartSidUrlString(cart)); +hPrintf("&db=%s", database); hPrintf("&g=htcDnaNearGene&i=%s", itemName); hPrintf("&c=%s&l=%d&r=%d", chrom, start, end); hPrintf("&o=%s&table=%s&primer3=1", table, table); hPrintf("\">"); } static void printGenomicAnchor(char *table, char *itemName, char *chrom, int start, int end) /* Print genomic sequence anchor. */ { hPrintf("<A HREF=\"%s?%s", hgcName(), cartSidUrlString(cart)); +hPrintf("&db=%s", database); hPrintf("&g=htcGeneInGenome&i=%s", itemName); hPrintf("&c=%s&l=%d&r=%d", chrom, start, end); hPrintf("&o=%s&table=%s", table, table); hPrintf("\" class=\"toc\">"); } void printGenomicSeqLink(struct sqlConnection *conn, char *geneId, char *chrom, int start, int end) /* Figure out known genes table, position of gene, link it. */ { char *table = genomeSetting("knownGene"); if (globalTdb) table = globalTdb->table; webPrintWideCellStart(3, HG_COL_TABLE); printGenomicAnchor(table, geneId, chrom, start, end); @@ -92,56 +94,56 @@ if (dy == NULL) { dy = dyStringNew(128); dyStringPrintf(dy, "%s?%s", hgcName(), cartSidUrlString(cart)); } return dy->string; } void printMrnaSeqLink(struct sqlConnection *conn, char *geneId) /* Print out link to fetch mRNA. */ { if (liftDb) // if we're quicklifting go through hgc because local functions assume sequence can come from files { char *command = "htcGeneMrna"; webPrintWideCellStart(2, HG_COL_TABLE); - printf("<A class=\"toc\" HREF=\"%s&g=%s&i=%s&c=%s&l=%d&r=%d&o=%s&table=%s\">", - hgcPathAndSettings(), command, geneId, curGenePred->chrom, curGenePred->txStart, curGenePred->txEnd, globalTdb->track,globalTdb->track); + printf("<A class=\"toc\" HREF=\"%s&db=%s&g=%s&i=%s&c=%s&l=%d&r=%d&o=%s&table=%s\">", + hgcPathAndSettings(), database, command, geneId, curGenePred->chrom, curGenePred->txStart, curGenePred->txEnd, globalTdb->track,globalTdb->track); printf("Predicted mRNA from genomic DNA</A>\n"); webPrintLinkCellEnd(); return; } char *title = "mRNA"; char *tableId = "knownGene"; if (genomeOptionalSetting("knownGeneMrna") != NULL) { title = "mRNA (may differ from genome)"; tableId = "knownGeneMrna"; } printSeqLink(conn, geneId, tableId, hggDoGetMrnaSeq, title, 2); } void printProteinSeqLink(struct sqlConnection *conn, char *geneId) /* Print out link to fetch protein. */ { if (liftDb) // if we're quicklifting go through hgc because local functions assume sequence can come from files { char *command = "htcTranslatedPredMRna"; webPrintWideCellStart(3, HG_COL_TABLE); - printf("<A class=\"toc\" HREF=\"%s&g=%s&i=%s&c=%s&l=%d&r=%d&o=%s&table=%s\">", - hgcPathAndSettings(), command, geneId, curGenePred->chrom, curGenePred->txStart, curGenePred->txEnd, "translate", globalTdb->track); + printf("<A class=\"toc\" HREF=\"%s&db=%s&g=%s&i=%s&c=%s&l=%d&r=%d&o=%s&table=%s\">", + hgcPathAndSettings(), database, command, geneId, curGenePred->chrom, curGenePred->txStart, curGenePred->txEnd, "translate", globalTdb->track); printf("Translated Protein from genomic DNA</A>\n"); webPrintLinkCellEnd(); return; } char *table = genomeSetting("knownGenePep"); char query[256]; char title[128]; sqlSafef(query, sizeof(query), "select length(seq) from %s where name='%s'" , table, geneId); int protSize = sqlQuickNum(conn, query); if (protSize > 0) { safef(title, sizeof(title), "Protein (%d aa)", protSize); printSeqLink(conn, geneId, "knownGenePep", hggDoGetProteinSeq,