3f5d580335f671dc10964ec9e5b549cb3cb9c367 max Tue Mar 26 06:36:26 2024 -0700 adding view chrom sizes menu entry and improving the seq view page a little, refs #25796 diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c index c98acd4..5b2c51f 100644 --- src/hg/hgTracks/hgTracks.c +++ src/hg/hgTracks/hgTracks.c @@ -8392,31 +8392,31 @@ } char *encodedShortLabel = htmlEncode(track->shortLabel); hPrintf("%s", encodedShortLabel); freeMem(encodedShortLabel); if (track->hasUi) hPrintf(""); hPrintf("
"); } static void printSearchHelpLink() /* print the little search help link next to the go button */ { char *url = cfgOptionDefault("searchHelpUrl","../goldenPath/help/query.html"); -char *label = cfgOptionDefault("searchHelpLabel", "examples"); +char *label = cfgOptionDefault("searchHelpLabel", "Examples"); if (!url || isEmpty(url)) return; printf("
%s
", url, label); } static void printPatchNote() { if (endsWith(chromName, "_fix") || endsWith(chromName, "_alt") || endsWith(chromName, "_hap")) { puts(""); puts(""); //puts(""); puts("Patch sequence"); } @@ -8989,31 +8989,31 @@ return; // bail out b/c we are done } if (!hideControls) { /* set white-space to nowrap to prevent buttons from wrapping when screen is * narrow */ hPrintf("
\n"); printMenuBar(); //menuBarAppendExtTools(); /* Show title */ freezeName = hFreezeFromDb(database); if(freezeName == NULL) freezeName = "Unknown"; - hPrintf(""); + hPrintf(""); // for these assemblies, we do not display the year, to save space and reduce clutter // Their names must include a "(" character char* noYearDbs[] = { "hg19", "hg38", "mm39", "mm10" }; if ( stringArrayIx(database, noYearDbs, ArraySize(noYearDbs)) != -1 ) { // freezeName is e.g. "Feb. 2009 (GRCh37/hg19)" char *afterParen = skipBeyondDelimit(freezeName, '('); afterParen--; // move back one char hPrintf("%s %s on %s %s", organization, browserName, organism, afterParen); } else if (startsWith("zoo",database) ) { hPrintf("%s %s on %s June 2002 Assembly %s target1", @@ -9026,30 +9026,33 @@ hPrintf("%s %s on Archaeon %s Assembly", organization, browserName, freezeName); } else { if (stringIn(database, freezeName)) hPrintf("%s %s on %s %s", organization, browserName, organism, freezeName); else hPrintf("%s %s on %s %s (%s)", organization, browserName, trackHubSkipHubName(organism), freezeName, trackHubSkipHubName(database)); } } hPrintf(""); + hPrintf("" + "Assembly Info", cartSessionId(cart)); + printDatabaseInfoHtml(database); // Disable recommended track set panel when changing tracks, session, database char *sessionLabel = cartOptionalString(cart, hgsOtherUserSessionLabel); char *oldDb = hashFindVal(oldVars, "db"); if (sessionLabel) { if (defaultTracks || hideAll || hideTracks || (oldDb && differentString(database, oldDb)) || !hasRecTrackSet(cart) || sameString(sessionLabel, "off")) cartRemove(cart, hgsOtherUserSessionLabel); } sessionLabel = cartOptionalString(cart, hgsOtherUserSessionLabel); if (sessionLabel) @@ -10817,88 +10820,76 @@ cgiTableRowEnd(); cgiSimpleTableRowStart(); cgiSimpleTableFieldStart(); printLongWithCommas(stdout, scafCount); cgiTableFieldEnd(); cgiSimpleTableFieldStart(); printLongWithCommas(stdout, totalSize); cgiTableFieldEnd(); } cgiTableRowEnd(); } sqlFreeResult(&sr); hFreeConn(&conn); } -static void chromSizesDownloadRow(boolean hasAlias, char *hubAliasFile, char *chromSizesFile) +static void chromSizesDownloadLinks(boolean hasAlias, char *hubAliasFile, char *chromSizesFile) /* Show link to chrom.sizes file at end of chromInfo table (unless this is a hub) */ { +puts("

"); if (! trackHubDatabase(database) || hubConnectIsCurated(trackHubSkipHubName(database))) { char *db = trackHubSkipHubName(database); - cgiSimpleTableRowStart(); - cgiSimpleTableFieldStart(); - puts("Download as file:"); - cgiTableFieldEnd(); - cgiSimpleTableFieldStart(); + puts("Download the table below as a text file: "); printf("%s.chrom.sizes", cgiAppendSForHttps(), hDownloadsServer(), db, db, db); - cgiTableFieldEnd(); + puts("  "); + if (hasAlias) { - cgiSimpleTableFieldStart(); /* see if this database has the chromAlias.txt download file */ char aliasFile[1024]; safef(aliasFile, sizeof aliasFile, "http%s://%s/goldenPath/%s/bigZips/%s.chromAlias.txt", cgiAppendSForHttps(), hDownloadsServer(), db, db); struct udcFile *file = udcFileMayOpen(aliasFile, udcDefaultDir()); if (file) { udcFileClose(&file); printf("%s.chromAlias.txt", aliasFile, db); } else puts(" "); - cgiTableFieldEnd(); } - cgiTableRowEnd(); } else if (hubAliasFile) { - cgiSimpleTableRowStart(); - cgiSimpleTableFieldStart(); - puts("Download as file:"); - cgiTableFieldEnd(); - cgiSimpleTableFieldStart(); + puts("Download the table below as a text file: "); if (chromSizesFile) { printf("%s.chrom.sizes.txt", chromSizesFile, trackHubSkipHubName(database)); puts("  "); } else puts(" "); - cgiTableFieldEnd(); - cgiSimpleTableFieldStart(); char *aliasUrl = cloneString(hubAliasFile); /* this URL reference needs to be a text file to work as a click in the * html page. Both files chromAlias.bb and chromAlias.txt exist. */ if (endsWith(hubAliasFile, "chromAlias.bb")) aliasUrl = replaceChars(hubAliasFile, "chromAlias.bb", "chromAlias.txt"); printf("%s.chromAlias.txt", aliasUrl, trackHubSkipHubName(database)); - cgiTableFieldEnd(); - cgiTableRowEnd(); } +puts("

"); } void chromInfoPage() /* Show list of chromosomes (or scaffolds, etc) on which this db is based. */ { boolean hasAlias = FALSE; char *chromSizesFile = NULL; char *aliasFile = NULL; if (trackHubDatabase(database)) { /* either one of these files present will work */ aliasFile = trackHubAliasFile(database); if (aliasFile) { hasAlias = TRUE; } else { @@ -10923,64 +10914,67 @@ hOrganism(database), freeze); else dyStringPrintf(title, "%s %s (%s) Browser Sequences", trackHubSkipHubName(hOrganism(database)), freeze, trackHubSkipHubName(database)); webStartWrapperDetailedNoArgs(cart, database, "", title->string, FALSE, FALSE, FALSE, FALSE); printf("
\n", hgTracksName()); cartSaveSession(cart); puts("Enter a position, or click on a sequence name to view the entire " "sequence in the genome browser.

"); puts("position "); hTextVar("position", addCommasToPos(database, position), 30); cgiMakeButton("Submit", "submit"); puts("

"); +chromSizesDownloadLinks(hasAlias, aliasFile, chromSizesFile); + hTableStart(); puts(""); + + cgiSimpleTableRowStart(); cgiSimpleTableFieldStart(); puts("Sequence name  "); cgiTableFieldEnd(); cgiSimpleTableFieldStart(); puts("Length (bp) including gaps  "); cgiTableFieldEnd(); if (hTableExists(database, "chromAlias")) { cgiSimpleTableFieldStart(); - puts("alias sequence names  "); + puts("Alias sequence names  "); cgiTableFieldEnd(); } else if (hasAlias) { cgiSimpleTableFieldStart(); - puts("alias sequence names  "); + puts("Alias sequence names  "); cgiTableFieldEnd(); } cgiTableRowEnd(); puts(""); if (sameString(database,"hg38")) chromInfoRowsChromExt("withAltRandom"); else if (trackHubDatabase(database)) chromInfoRowsNonChrom(hasAlias, 1000); else if ((startsWith("chr", defaultChrom) || startsWith("Group", defaultChrom)) && hChromCount(database) < 100) chromInfoRowsChrom(); else chromInfoRowsNonChrom(hasAlias, 1000); -chromSizesDownloadRow(hasAlias, aliasFile, chromSizesFile); hTableEnd(); cgiDown(0.9); hgPositionsHelpHtml(organism, database); puts("

"); dyStringFree(&title); webEndSectionTables(); } /* void chromInfoPage() */ void resetVars() /* Reset vars except for position and database. */ { static char *except[] = {"db", "position", NULL}; char *cookieName = hUserCookie();