7976e2588e92dca0567231cf3998759bf6f1827f
max
  Thu May 7 03:27:42 2015 -0700
implementing the external tools "send to" menu, refs #15113

diff --git src/hg/hgc/lrgClick.c src/hg/hgc/lrgClick.c
index 1199348..23fed27 100644
--- src/hg/hgc/lrgClick.c
+++ src/hg/hgc/lrgClick.c
@@ -1,28 +1,29 @@
 /* lrgClick.c - Locus Reference Genomic (LRG) sequences mapped to genome assembly */
 
 /* Copyright (C) 2013 The Regents of the University of California 
  * See README in this or parent directory for licensing information. */
 
 #include "common.h"
 #include "hgc.h"
 #include "bigBed.h"
 #include "fa.h"
 #include "genbank.h"
 #include "hdb.h"
 #include "trackHub.h"
 #include "lrg.h"
+#include "hui.h"
 
 INLINE void printStartAndMaybeEnd(uint start, uint end)
 {
 if (end == start+1)
     printf("%d", end);
 else
     printf("%d-%d", start+1, end);
 }
 
 static void printLrgDiffs(struct lrg *lrg, struct lrgDiff *diffList)
 /* Diffstr is a comma-separated list of colon-separated blkStart, lrgStart, assemblySeq, lrgSeq.
  * Make it more readable as a table with links to position ranges. */
 {
 printf("<TABLE class='stdTbl'>\n"
        "<TR><TH>%s<BR>location</TH><TH>%s<BR>sequence</TH>"
@@ -90,42 +91,44 @@
     if (bbFieldCount != fieldCount)
 	errAbort("doLrg: inconsistent fieldCount (bbi has %d, row has %d)",
 		 fieldCount, bbFieldCount);
     struct lrg *lrg = lrgLoad(fields);
     if (differentString(lrg->name, item))
 	continue;
     found = TRUE;
     printCustomUrl(tdb, lrg->name, TRUE);
     bedPrintPos((struct bed *)lrg, bedSize, tdb);
     char *url = hashFindVal(columnUrls, "hgncId");
     printf("<B>HGNC Gene Symbol:</B> ");
     if (isNotEmpty(url))
 	{
 	char hgncIdStr[32];
 	safef(hgncIdStr, sizeof(hgncIdStr), "%d", lrg->hgncId);
-	char *idUrl = replaceInUrl(tdb, url, hgncIdStr, TRUE);
+        char *idUrl = replaceInUrl(url, hgncIdStr, cart, database, seqName, winStart, 
+                    winEnd, tdb->track, TRUE);
 	printf("<A HREF='%s' TARGET=_BLANK>%s</A><BR>\n", idUrl, lrg->hgncSymbol);
 	}
     else
 	printf("%s<BR>\n", lrg->hgncSymbol);
     printf("<B>Source of LRG sequence:</B> "
 	   "<A HREF='%s' TARGET=_BLANK>%s</A><BR>\n", lrg->lrgSourceUrl, lrg->lrgSource);
     printf("<B>LRG Sequence at NCBI:</B> ");
     url = hashFindVal(columnUrls, "ncbiAcc");
     if (isNotEmpty(url))
 	{
-	char *idUrl = replaceInUrl(tdb, url, lrg->ncbiAcc, TRUE);
+        char *idUrl = replaceInUrl(url, lrg->ncbiAcc, cart, database, seqName, winStart, 
+                    winEnd, tdb->track, TRUE);
 	printf("<A HREF='%s' TARGET=_BLANK>%s</A><BR>\n", idUrl, lrg->ncbiAcc);
 	}
     else
 	printf("%s<BR>\n", lrg->ncbiAcc);
     printf("<B>Creation Date:</B> %s<BR>\n", lrg->creationDate);
     char *assemblyDate = hFreezeDate(database);
     if (isNotEmpty(lrg->mismatches))
 	{
 	printf("<BR><B>Mismatches between %s and %s assembly sequence:</B><BR>\n",
 	       lrg->name, assemblyDate);
 	struct lrgDiff *mismatches = lrgParseMismatches(lrg);
 	printLrgDiffs(lrg, mismatches);
 	}
     if (isNotEmpty(lrg->indels))
 	{
@@ -209,31 +212,33 @@
 struct psl *psl = getAlignments(conn, tdb->table, item);
 struct genbankCds *cds = getLrgCds(conn, tdb, psl);
 hFreeConn(&conn);
 
 genericHeader(tdb, item);
 char *url = trackDbSetting(tdb, "url");
 if (isNotEmpty(url))
     {
     char *lrgName = cloneString(item);
     // Truncate the "t1" part to get the LRG ID for link:
     char *p = strchr(lrgName, 't');
     if (p)
 	*p = '\0';
     char *urlLabel = trackDbSettingOrDefault(tdb, "urlLabel", "LRG Transcript link");
     printf("<B>%s</B> ", urlLabel);
-    char *lrgTUrl = replaceInUrl(tdb, url, lrgName, TRUE);
+    //char *lrgTUrl = replaceInUrl(tdb, url, lrgName, TRUE);
+    char *lrgTUrl = replaceInUrl(url, lrgName, cart, database, seqName, winStart, 
+                    winEnd, tdb->track, TRUE);
     printf("<A HREF='%s' TARGET=_BLANK>%s</A><BR>\n", lrgTUrl, item);
     }
 
 struct genePred *gp = genePredFromPsl3(psl, cds, genePredAllFlds, genePredPslCdsMod3, -1, -1);
 printPos(gp->chrom, gp->txStart, gp->txEnd, gp->strand, FALSE, NULL);
 printf("<H3>Links to %s sequence:</H3>\n", item);
 printf("<UL>\n");
 char *pepTable = trackDbSetting(tdb, "pepTable");
 if ((pepTable != NULL) && hGenBankHaveSeq(database, item, pepTable))
     {
     puts("<LI>\n");
     hgcAnchorSomewhere("htcTranslatedProtein", item, pepTable, seqName);
     printf("Translated Protein</A> \n");
     puts("</LI>\n");
     }