037fad09eb0c322d3ede8e3a20fad478777d58f3 braney Tue Jul 9 14:28:33 2013 -0700 resolve newly introduced error in menu bar, notify users that hgVai doesn't work with assembly hubs, and resolve caching problems with assembly hubs (set udc cache timeout before opening hubs (otherwise the default is 0), don't open 2bit files until they are actually used) diff --git src/hg/hgTracks/menu.c src/hg/hgTracks/menu.c index ffa4d41..4d04ed1 100644 --- src/hg/hgTracks/menu.c +++ src/hg/hgTracks/menu.c @@ -1,30 +1,31 @@ // Code to create hgTracks menu bar #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 "liftOver.h" #include "wikiLink.h" #include "web.h" #include "geoMirror.h" #include "hgTracks.h" +#include "trackHub.h" /* list of links to display in a menu */ struct hotLink { struct hotLink *next; char *name; char *url; char *id; boolean external; }; static void appendLink(struct hotLink **links, char *url, char *name, char *id, boolean external) { // append to list of links for later printing and/or communication with javascript client struct hotLink *link; @@ -125,54 +126,56 @@ { int agpStart = winStart - agpItem->chromStart; int agpEnd = agpStart + winEnd - winStart; printEnsemblAnchor(database, archive, agpItem->frag, agpStart, agpEnd, links); } } agpFragFree(&agpItem); // the one we maybe used } void printMenuBar() /* Put up the menu bar. */ { struct hotLink *link, *links = NULL; int i, len; -struct sqlConnection *conn = hAllocConn(database); +struct sqlConnection *conn = NULL; +if (!trackHubDatabase(database)) + conn = hAllocConn(database); char *menuStr, buf[4096], uiVars[1024]; safef(uiVars, sizeof(uiVars), "%s=%u", cartSessionVarName(), cartSessionId(cart)); menuStr = menuBar(cart); // Create top items in view menu safef(buf, sizeof(buf), "../cgi-bin/hgTracks?%s&hgt.psOutput=on", uiVars); appendLink(&links, buf, "PDF/PS", "pdfLink", FALSE); safef(buf, sizeof(buf), "%s&o=%d&g=getDna&i=mixed&c=%s&l=%d&r=%d&db=%s&%s", hgcNameAndSettings(), winStart, chromName, winStart, winEnd, database, uiVars); appendLink(&links, buf, "DNA", "dnaLink", FALSE); safef(buf, sizeof(buf), "../cgi-bin/hgConvert?hgsid=%d&db=%s", cartSessionId(cart), database); appendLink(&links, buf, "in other Genomes (Convert)", "convertMenuLink", FALSE); // Add link-outs to other dbs as appropriate for this assembly if (differentWord(database,"susScr2")) { /* Print Ensembl anchor for latest assembly of organisms we have * supported by Ensembl == if versionString from trackVersion exists */ char ensVersionString[256], ensDateReference[256]; ensGeneTrackVersion(database, ensVersionString, ensDateReference, sizeof(ensVersionString)); - if (sqlTableExists(conn, UCSC_TO_ENSEMBL)) + if ((conn != NULL) && sqlTableExists(conn, UCSC_TO_ENSEMBL)) printEnsemblAnchor(database, NULL, chromName, winStart, winEnd, &links); else if (sameWord(database,"hg19")) { printEnsemblAnchor(database, NULL, chromName, winStart, winEnd, &links); } else if (sameWord(database,"hg18")) { printEnsemblAnchor(database, "ncbi36", chromName, winStart, winEnd, &links); } else if (sameWord(database,"oryCun2") || sameWord(database,"anoCar2") || sameWord(database,"calJac3")) { printEnsemblAnchor(database, NULL, chromName, winStart, winEnd, &links); } else if (ensVersionString[0]) {