bd998f55bff39941de393c98ae3bb5e26ebdd836 kate Wed Feb 24 16:45:44 2021 -0800 Changes to link wording, from review input. refs #26385 diff --git src/hg/lib/hui.c src/hg/lib/hui.c index 4f4a99a..b1a2c61 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -353,31 +353,31 @@ /* Make a link to launch browser in multi-region custom URL mode, based on * track setting. This includes creating a custom track displaying the regions. * The link switches to exit multi-region if browser is already in multi-region mode * based on regions defined for this track. */ { char *regionUrl = trackDbSetting(tdb, MULTI_REGION_BED_URL); if (isEmpty(regionUrl)) return FALSE; // make custom track for regions, alternating colors // TODO: truncate CT name and label at word boundary // TODO: fix bedPackDense to work with multi-region // TODO: limit number of regions ? struct dyString *dsCustomText = dyStringCreate( - "track name=\'%s Regions\' description=\'Regions of interest for track: %s' " + "track name=\'%s ROI\' description=\'[Regions of Interest] %s' " "visibility=dense bedPackDense=on labelOnFeature=on itemRgb=on noScoreFilter=on\n", tdb->shortLabel, tdb->longLabel); #ifdef LATER // TODO: libify struct dyString *ds = NULL; struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { int sd = netUrlOpen(regionUrl); if (sd >= 0) { char *newUrl = NULL; int newSd = 0; if (netSkipHttpHeaderLinesHandlingRedirect(sd, regionUrl, &newSd, &newUrl)) @@ -441,30 +441,31 @@ char regionInfo[1024]; char *regionFile = cloneString(mrTn.forCgi); // TODO: trackDb setting ? #define MULTI_REGION_BED_DEFAULT_PADDING 1000 int padding = MULTI_REGION_BED_DEFAULT_PADDING; safef(regionInfo, sizeof regionInfo, "#padding %d\n", padding); mustWrite(f, regionInfo, strlen(regionInfo)); #ifdef LATER safef(regionInfo, sizeof regionInfo, "#shortDesc %s\n", name); mustWrite(f, regionInfo, strlen(regionInfo)); #endif // write to trash file and custom track +int regionCount = 0; while (lineFileChopNext(lf, words, bedSize)) { region = bedLoadN(words, bedSize); if (bedSize < 9) { // assign alternating light/dark color color = doLightColor ? colorLight : colorDark; doLightColor = !doLightColor; } else { // no lib ? sigh int colorIx = (int)region->itemRgb; struct rgbColor rgb = colorIxToRgb(colorIx); safef(userColor, sizeof userColor, "%d,%d,%d", rgb.b, rgb.g, rgb.r); @@ -482,67 +483,71 @@ { strcpy(name, region->name); } // write to trash file safef(regionInfo, sizeof regionInfo, "%s\t%d\t%d\n", region->chrom, region->chromStart, region->chromEnd); mustWrite(f, regionInfo, strlen(regionInfo)); // write to custom track int start = max(region->chromStart - padding, 0); int end = min(region->chromEnd + padding, hChromSize(db, region->chrom)); dyStringPrintf(dsCustomText, "%s\t%d\t%d\t%s\t" "0\t.\t%d\t%d\t%s\n", region->chrom, start, end, name, start, end, color); + regionCount++; } lineFileClose(&lf); fclose(f); // create SHA1 file; used to see if file has changed unsigned char hash[SHA_DIGEST_LENGTH]; SHA1((const unsigned char *)regionInfo, strlen(regionInfo), hash); char newSha1[(SHA_DIGEST_LENGTH + 1) * 2]; hexBinaryString(hash, SHA_DIGEST_LENGTH, newSha1, (SHA_DIGEST_LENGTH + 1) * 2); char sha1File[1024]; safef(sha1File, sizeof sha1File, "%s.sha1", mrTn.forCgi); f = mustOpen(sha1File, "w"); mustWrite(f, newSha1, strlen(newSha1)); carefulClose(&f); char customHtml[1000]; safef(customHtml, sizeof customHtml, "<h2>Description</h2>\n" "<p>This custom track displays regions of interest for the " "<a href='../cgi-bin/hgTrackUi?db=%s&g=%s'><em>%s</em> track</a>.</p>", db, tdb->track, tdb->shortLabel); // TODO: support #padding in custom regions file -printf("<p>View regions of interest for this track in " - "<a target='_blank' href='../cgi-bin/hgTracks?" +printf("<p>Display %d regions of interest for this track in " + "<a href='../cgi-bin/hgTracks?" "virtMode=1&" "virtModeType=customUrl&" "virtWinFull=on&" "virtShortDesc=%s&" "multiRegionsBedUrl=%s&" "%s=%s&" "%s=%s'>" "multi-region view</a>" - " (custom regions mode)</p>", - tdb->track, cgiEncode(regionFile), + " (custom regions mode)", + regionCount, tdb->track, cgiEncode(regionFile), CT_CUSTOM_DOC_TEXT_VAR, cgiEncode(customHtml), CT_CUSTOM_TEXT_VAR, cgiEncode(dyStringCannibalize(&dsCustomText))); +printf(" "); +printf("<a href=\"../goldenPath/help/multiRegionHelp.html\" target=_blank>(Help)</a>\n"); +printf("</p>"); return TRUE; } void extraUiLinks(char *db,struct trackDb *tdb) // Show metadata, and downloads, schema links where appropriate { makeMultiRegionLink(db, tdb); struct slPair *pairs = trackDbMetaPairs(tdb); if (pairs != NULL) printf("<b>Metadata:</b><br>%s\n", pairsAsHtmlTable( pairs, tdb, FALSE, FALSE)); else if (!tdbIsComposite(tdb) && !trackHubDatabase(db) && (metadataForTable(db, tdb, NULL) != NULL)) printf("<b>Metadata:</b><br>%s\n", metadataAsHtmlTable(db, tdb, FALSE, FALSE)); boolean schemaLink = trackDataAccessible(db, tdb);