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("</A>"); hPrintf("<BR>"); } 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("<div id='searchHelp'><a target=_blank title='Documentation on what you can enter into the Genome Browser search box' href='%s'>%s</a></div>", url, label); } static void printPatchNote() { if (endsWith(chromName, "_fix") || endsWith(chromName, "_alt") || endsWith(chromName, "_hap")) { puts("<span id='patchNote'><svg xmlns='http://www.w3.org/2000/svg' height='1em' viewBox='0 0 512 512'><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d='M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z'/></svg>"); puts("<a href='https://genome.ucsc.edu/FAQ/FAQreleases.html#patches' target=_blank>"); //puts("<svg xmlns='http://www.w3.org/2000/svg' height='1em' viewBox='0 0 512 512'><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d='M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm169.8-90.7c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z'/></svg>"); puts("Patch sequence</a></span>"); } @@ -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("<DIV STYLE=\"white-space:nowrap;\">\n"); printMenuBar(); //menuBarAppendExtTools(); /* Show title */ freezeName = hFreezeFromDb(database); if(freezeName == NULL) freezeName = "Unknown"; - hPrintf("<span style='font-size:large;'><B>"); + hPrintf("<span id='assemblyName' style='font-size:large;'><B>"); // 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("</B></SPAN>"); + hPrintf("<span target=_blank title='Show details about this assembly' id='gatewayLink'>" + "<a href='hgGateway?hgsid=%s'>Assembly Info</a></span>", 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("<p>"); 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("<a href='http%s://%s/goldenPath/%s/bigZips/%s.chrom.sizes' target=_blank>%s.chrom.sizes</a>", 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("<a href='%s' target=_blank>%s.chromAlias.txt</a>", 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("<a href='%s' target=_blank>%s.chrom.sizes.txt</a>", 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("<a href='%s' target=_blank>%s.chromAlias.txt</a>", aliasUrl, trackHubSkipHubName(database)); - cgiTableFieldEnd(); - cgiTableRowEnd(); } +puts("</p>"); } 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("<FORM ACTION=\"%s\" NAME=\"posForm\" METHOD=GET>\n", hgTracksName()); cartSaveSession(cart); puts("Enter a position, or click on a sequence name to view the entire " "sequence in the genome browser.<P>"); puts("position "); hTextVar("position", addCommasToPos(database, position), 30); cgiMakeButton("Submit", "submit"); puts("<P>"); +chromSizesDownloadLinks(hasAlias, aliasFile, chromSizesFile); + hTableStart(); puts("<thead style='position:sticky; top:0; background-color: white;'>"); + + 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("</thead>"); 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("</FORM>"); dyStringFree(&title); webEndSectionTables(); } /* void chromInfoPage() */ void resetVars() /* Reset vars except for position and database. */ { static char *except[] = {"db", "position", NULL}; char *cookieName = hUserCookie();