cc23b76a1f2c7dc6a29c227661bfb0ce4d20eb54 lrnassar Fri Sep 4 13:43:48 2026 -0700 BLAT page polish from QA: Load example button, corrected input limits, wording fixes. refs #37996 Load example is a chip-style button with a mouseover instead of a hyperlink. Removed the Show input limits modal; corrected the limits in hgTracksHelp.html, stale since 2013 (DNA is 75,000 bases per sequence and 187,500 combined, protein and translated 10,000 and 25,000), added a #blatLimits anchor and pointed the two over-limit BLAT warnings and the form at it. Genome selector: section title Target assembly, type-to-search hint in the dropdown, Shortcuts: label, input and Query type select sized to match. Similar tools sidebar uses house-style hyphens and corrects the findMotif name and description. Share and rename text now states link lifetimes accurately (snapshot links last years, only sessions are permanent). Alignment page buttons match .gbPill, summary strip spacing fixed, New BLAT search button demoted from primary. Documents blatResultsGroup in ex.hg.conf. diff --git src/hg/js/hgBlat.js src/hg/js/hgBlat.js index 4f86984aaf0..1212770ffcb 100644 --- src/hg/js/hgBlat.js +++ src/hg/js/hgBlat.js @@ -282,33 +282,35 @@ // Render the share box. url set -> show the link + Copy; url null -> "Creating link…"; msg (url null) // -> show an error. function blatShowShareBox(box, url, msg) { box.style.display = 'flex'; if (msg) { box.innerHTML = '' + htmlEncode(msg) + ''; return; } if (!url) { box.innerHTML = 'Creating link…'; return; } box.innerHTML = - 'Shareable link — anyone with it can reopen these ' + - 'BLAT results. It stores only the results (not your other tracks or settings) and stays ' + - 'active as long as it is used.' + + 'Anyone with this shareable link can open ' + + 'these BLAT results. It stores only the results, not your other tracks or settings. The ' + + 'link remains valid for years; to keep your results permanently, save them into a ' + + `Session.` + '' + ''; var inp = document.getElementById('gbShareInput'); inp.value = url; inp.focus(); inp.select(); $('#blatShareCopy').on('click', function() { inp.select(); if (navigator.clipboard) { navigator.clipboard.writeText(url); } else { document.execCommand('copy'); } this.textContent = 'Copied'; }); } function blatShareLink() { @@ -350,31 +352,31 @@ // ---- Rename BLAT track (modal) ------------------------------------------- // The results custom track is built (and renamed) by hgBlat.c's inline code, which exposes a small // window.blatRenameCt(name, description) helper (it POSTs to hgc's buildBigPsl and rebuilds the // track). We reuse that helper (no new endpoint), just swapping its old inline toggle-form UI for a // proper modal dialog. The current name/description come from cfg (hgBlat.c), not a global, so this // does not depend on any generic page-global. function blatRenameModalHtml(cfg) { // hgSession link is relative (same /cgi-bin/), carrying db + hgsid so the session page opens in // this assembly and cart. var sessionUrl = `hgSession?db=${encodeURIComponent(cfg.db)}&hgsid=${encodeURIComponent(cfg.hgsid)}`; return ''; } function blatCloseRename() { var bg = document.getElementById('gbModalBg'); if (bg) { bg.style.display = 'none'; } } @@ -477,31 +479,31 @@ // render too so the dialog shows the full server+client picture. var tBuildStart = (hgBlatData.timing && window.performance) ? performance.now() : 0; // Pin a stable, shareable URL into the address bar (no server redirect) so refresh, bookmark and // "Share a link" all use the trash-backed reopen link instead of the transient POST/search URL. if (cfg.shareUrl) { try { history.replaceState(null, '', cfg.shareUrl); } catch (e) { /* older browsers: ignore */ } } var back = cfg.backUrl ? `Back to Genome Browser` : ''; // The page actions live in the gold main-header bar (framework #sectTtl), next to the title - // so there is no separate toolbar (.blatHead is gone). Injected into #sectTtl below. var headActions = - `${back}New BLAT search`; + `${back}New BLAT search`; // Top banner: note this is the new page, link back to the classic page (fresh searches only, // where the trash files still exist), and invite feedback. The old page also clears the // blatNewPage preference so later searches use the classic page until the user opts back in. var origPage = cfg.canOldPage ? ` You can go back to the original page anytime.` : ''; var bannerHtml = `
We are testing a new BLAT output page.${origPage} ` + `If you have feedback on this new page, do not hesitate to let us know via ` + `genome@soe.ucsc.edu.
`; var queryCount = new Set(hits.map(h => h.qName)).size; var th = []; @@ -687,58 +689,44 @@ } function blatOpts(list, cur) { return list.map(function(v) { return ``; }).join(''); } function blatFormCount() { // Live character count under the textarea. Only these two nodes are touched on input - the // textarea itself is never re-rendered, so the caret stays where the user put it. var ta = document.getElementById('blatUserSeq'); var out = document.getElementById('blatCountText'); if (!ta || !out) { return; } var n = ta.value.replace(/[^A-Za-z*]/g, '').length; - out.textContent = blatFmt(n) + ' of 25,000 characters'; - $('#blatLimitLink').toggleClass('over', n > 25000); + // 75,000 is the DNA per-sequence limit (hgBlat.c maxSingleSize); protein and translated + // queries top out at 10,000, but the server rejects those with a warning that links to the + // full limits in the docs, so the counter shows only the common case. + out.textContent = blatFmt(n) + ' of 75,000 characters'; + out.classList.toggle('over', n > 75000); } function blatFormTab(showUpload) { $('#blatTabPaste').toggleClass('on', !showUpload); $('#blatTabUpload').toggleClass('on', showUpload); $('#blatPanePaste').toggle(!showUpload); $('#blatPaneUpload').toggle(showUpload); } -function blatFormLimitsModal() { - var row = (k, v) => `
${k}${v}
`; - return ''; -} - function blatFormBusyMarkup() { // Spinner overlay shown between Submit and the arrival of the results page. Built with the // form (hidden) rather than on demand, so nothing has to be parsed or fetched at the moment the // browser is already busy navigating away. return '
' + '
' + '
Running BLAT…
' + '
'; } function blatFormBusyWire(cfg) { // The search is a plain form POST that navigates the page, so between the click on Submit and // the arrival of the results nothing on screen changes at all - and a BLAT run is anywhere from // under a second to well over half a minute, the long end being an assembly served by a dynamic // BLAT server, which has to load its index from disk before it can answer. Cover the form with @@ -808,39 +796,40 @@ document.mainForm.db.value = db; $('#blatFormBox a[data-urltpl]').each(function() { this.href = this.getAttribute('data-urltpl').replace('$DB$', encodeURIComponent(db)); }); } function blatFormSidebar(cfg) { // Same links the classic page offered. hgBlat.c supplies them as templates holding $DB$ (see // blatFormSetDb); the template is kept in data-urltpl so the link can be retargeted later. var tools = ''; var tplLink = (tpl, label) => { var href = tpl.replace('$DB$', encodeURIComponent(hgBlatFormData.db)); return `${label}`; }; if (cfg.pcrUrlTpl) { - tools += `
${tplLink(cfg.pcrUrlTpl, 'In-Silico PCR')} — better than BLAT for ` + + tools += `
${tplLink(cfg.pcrUrlTpl, 'In-Silico PCR')} - better than BLAT for ` + 'locating PCR primers.
'; } if (cfg.oligoMatchUrlTpl) { - tools += `
${tplLink(cfg.oligoMatchUrlTpl, 'Short Sequence Match')} — for ` + + tools += `
${tplLink(cfg.oligoMatchUrlTpl, 'Short Sequence Match')} - for ` + 'sequences under 20 bp, within the region shown in the Genome Browser.
'; } tools += '
' + - 'findMotifs — command-line search across a whole genome.
'; + 'findMotif - like Short Sequence Match, but searches a whole genome, ' + + 'from the command line.
'; return '
' + (tools ? `

Similar tools

${tools}
` : '') + '

Help

' + '
BLAT FAQ
' + '
BLAT documentation
' + // No "Search all genomes FAQ" here: that link now lives in the "Search many genomes" // tooltip, next to the checkbox it actually explains. '
Programmatic / batch BLAT
' + '
' + '

About BLAT

' + '
DNA BLAT quickly finds sequences of 95% and greater similarity that are at least 25 bases ' + 'long; it finds perfect matches down to 20 bases, and may miss shorter or more divergent ' + 'alignments. Protein BLAT finds sequences of 80% and greater similarity at least 20 amino acids ' + 'long.
' + '
Kent WJ. ' + @@ -876,31 +865,31 @@ var keepResultsInit = cfg.keepResults; if (cfg.showKeepResults) { var storedKeep = blatGetKeepResultsPref(); if (storedKeep !== null) { keepResultsInit = storedKeep; } } var onlyLatestInit = cfg.onlyLatest; if (cfg.showOnlyLatest) { var storedLatest = blatGetOnlyLatestPref(); if (storedLatest !== null) { onlyLatestInit = storedLatest; } } document.getElementById('blatFormBox').innerHTML = banner + '' + blatFormSidebar(cfg) + '
' + - blatFormLimitsModal() + blatFormBusyMarkup(); // Move the C-generated genome search bar (real autocomplete over every assembly, already wired // by setupGenomeSearchBar) into its slot, rather than reimplementing it with a hardcoded list. var holder = document.getElementById('blatGenomeHolder'); if (holder) { document.getElementById('blatGenomeSlot').appendChild(holder); } // Show the current assembly in the search bar itself instead of in a separate "Current genome:" // line - the bar is wide enough for the whole description. setupGenomeSearchBar writes the new // one in on each pick, and focusing the bar selects all of it, so it reads as a filled-in search // box rather than as a value the user has to clear by hand. var genomeInput = document.getElementById('genomeSearch'); if (genomeInput && cfg.dbLabel) { genomeInput.value = cfg.dbLabel; } @@ -1011,67 +999,60 @@ $('#blatUserSeq').on('input', blatFormCount); // Mirror the "Keep results" checkbox into its hidden field so an unticked box submits an // explicit 0 rather than nothing at all, and remember the choice in localStorage so it comes // back pre-set on the user's next visit (see keepResultsInit above). $('#blat_keepResults').on('change', function() { document.getElementById('blatKeepResultsVal').value = this.checked ? '1' : '0'; blatSetKeepResultsPref(this.checked); }); $('#blat_onlyLatest').on('change', function() { document.getElementById('blatOnlyLatestVal').value = this.checked ? '1' : '0'; blatSetOnlyLatestPref(this.checked); }); $('#blatTabPaste').on('click', function() { blatFormTab(false); }); $('#blatTabUpload').on('click', function() { blatFormTab(true); }); // The example sequence is a real 2.5 kb query, fetched on demand so it is not carried in every - // page load. The link doubles as its own status indicator while the request is in flight. - $('#blatExample').on('click', function(ev) { - ev.preventDefault(); + // page load. The button doubles as its own status indicator while the request is in flight, + // and is disabled for that interval so a double-click cannot start a second fetch. + $('#blatExample').on('click', function() { var link = this; var label = cfg.exampleLabel; + link.disabled = true; link.textContent = 'Loading example…'; fetch(cfg.exampleUrl) .then(function(resp) { if (!resp.ok) { throw new Error('HTTP ' + resp.status); } return resp.text(); }) .then(function(fa) { var ta = document.getElementById('blatUserSeq'); ta.value = fa.trim(); blatFormCount(); ta.focus(); ta.setSelectionRange(0, 0); ta.scrollTop = 0; link.textContent = label; + link.disabled = false; blatFormTab(false); // in case the user was on the upload tab }) .catch(function(err) { link.textContent = 'Could not load example'; // Leave the message up briefly, then let the user try again. - setTimeout(function() { link.textContent = label; }, 4000); + setTimeout(function() { link.textContent = label; link.disabled = false; }, 4000); console.error('hgBlat: example fetch failed:', err); }); }); - $('#blatLimitLink').on('click', function(ev) { - ev.preventDefault(); - $('#blatLimitsBg').css('display', 'flex'); - }); - $('#blatLimitsClose').on('click', function() { $('#blatLimitsBg').hide(); }); - $('#blatLimitsBg').on('click', function(ev) { if (ev.target === this) { $(this).hide(); } }); - $(document).on('keydown.blatLimits', function(ev) { - if (ev.key === 'Escape') { $('#blatLimitsBg').hide(); } - }); var fileInput = document.getElementById('blatSeqFile'); var drop = document.getElementById('blatDrop'); $(fileInput).on('change', function() { document.getElementById('blatFileName').textContent = this.files && this.files.length ? this.files[0].name : ''; }); ['dragenter', 'dragover'].forEach(function(e) { drop.addEventListener(e, function(ev) { ev.preventDefault(); drop.classList.add('hot'); }); }); ['dragleave', 'drop'].forEach(function(e) { drop.addEventListener(e, function(ev) { ev.preventDefault(); drop.classList.remove('hot'); }); }); drop.addEventListener('drop', function(ev) { if (ev.dataTransfer.files.length) {