60527238f7fe8afc89824e93b0d8780f1bcf65ad chmalee Wed May 6 14:38:50 2026 -0700 Rename my variants to my annotations where appropriate, refs #33808 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index c77dfa87a06..7dee19c323a 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -637,40 +637,40 @@ } }); $(positionDialog).dialog('open'); } }; ///////////////////////////////////// //// Creating items ///// ///////////////////////////////////// var myVariants = { createBedForm: function(dialogEle) { // Simple fields shown by default (matches hgc edit form style) const simpleFields = [ { label: "Label", id: "name", type: "text", placeholder: "Optional item label", - info: "A short label for this variant, displayed in the browser." }, + info: "A short label for this item, displayed in the browser." }, { label: "Color", id: "color", type: "color" }, { label: "Ref", id: "ref", type: "text", placeholder: "Optional reference allele sequence", info: "Reference allele sequence at this position." }, { label: "Alt", id: "alt", type: "text", placeholder: "Optional alternate allele sequence", info: "Alternate (variant) allele sequence." }, { label: "Mouseover", id: "mouseover", type: "text", placeholder: "Short text shown on hover", info: "Short text shown when hovering over this item. If empty, the label and alleles are displayed." }, { label: "Description", id: "description", type: "textarea", placeholder: "Longer description/notes", - info: "Longer notes or comments about this variant. Displayed on the details page." }, + info: "Longer notes or comments about this item. Displayed on the details page." }, { label: "Project", id: "project", type: "text", placeholder: "Optional project name", info: "Group variants by project. Projects with no items are automatically removed from the list." }, ]; // Advanced fields hidden by default const advancedFields = [ { label: "Chromosome", id: "chrom", type: "text" }, { label: "Start", id: "start", type: "number", info: "1-based start position on the chromosome." }, { label: "End", id: "end", type: "number", info: "1-based end position on the chromosome (inclusive)." }, { label: "Score", id: "score", type: "number", info: "Score from 0-1000. Higher scores display darker." }, { label: "Strand", id: "strand", type: "text", info: "Strand: + for forward, - for reverse, . for unknown." }, @@ -928,31 +928,31 @@ if (newProjectInput.value === "" && select.value === "__new__") { select.value = ""; newProjectInput.style.display = "none"; } }); } else { // No existing projects - just show text input let input = document.createElement("input"); input.type = "text"; input.id = "project"; input.placeholder = "Optional project name"; wrapper.appendChild(input); } // Add info icon - wrapper.appendChild(createInfoIcon("Group variants by project. Projects with no items are automatically removed from the list.")); + wrapper.appendChild(createInfoIcon("Group annotations by project. Projects with no items are automatically removed from the list.")); container.appendChild(wrapper); }; // Create simple fields let colorInput = null; simpleFields.forEach(field => { // Handle project field specially if (field.id === "project") { createProjectField(manualInpDiv); } else { let input = createField(field, manualInpDiv); if (field.id === "color") { colorInput = input; } } @@ -1257,31 +1257,31 @@ msg.innerHTML = "Please <a href=\"./hgSession\">log in</a> to use this feature."; dialog.appendChild(msg); } else { let form = this.createBedForm(dialog); document.body.append(dialog); dialogButtons.Submit = function() { // extract the form elements and check myVariants.createItem(form); }; } dialogButtons.Cancel = function(){ $(this).dialog("close"); }; $(dialog).dialog({ - title: "My Variants", + title: "My Annotations", resizable: false, height: "auto", width: 580, modal: true, closeOnEscape: true, autoOpen: false, buttons: dialogButtons }); } else { // got here after async image update, need to update the bed form coordinates let form = document.getElementById("myVariants-form"); let start = form.elements.start; let end = form.elements.end; let thickStart = form.elements.thickStart; let thickEnd = form.elements.thickEnd; @@ -1363,31 +1363,31 @@ }) .then(response => { if (!response.ok) { throw new Error("Network response was not ok: " + response.status); } return response.text(); }) .then(html => { hideLoadingImage(loadingId); document.body.style.cursor = ""; myVariants.handleCreateSuccess(html, data); }) .catch(error => { hideLoadingImage(loadingId); document.body.style.cursor = ""; - warn("Error creating variant: " + error.message); + warn("Error creating annotation: " + error.message); console.error("Fetch error:", error); }); }, handleCreateSuccess: function(response, data) { // Close the create dialog $("#myVariantsDialog").dialog("close"); // Update the image using the existing pattern imageV2.updateImgAndMap.call({cmd: 'wholeImage'}, response, 'success'); // Extract new item coordinates from server response const newItemPos = scrapeVariable(response, "newItemPos"); let variantChrom, variantStart, variantEnd; @@ -1409,80 +1409,80 @@ variantEnd > hgTracks.winStart); if (inCurrentWindow) { // Already visible - just show brief success message return; } // Check stored preference const navPref = localStorage.getItem("myVariants_navPref"); if (navPref === "jump") { // Auto-navigate to variant myVariants.navigateToVariant(variantChrom, variantStart, variantEnd); return; } else if (navPref === "stay") { // Stay here, just show message - warn("Variant created at " + variantChrom + ":" + + warn("Annotation created at " + variantChrom + ":" + (variantStart+1).toLocaleString() + "-" + variantEnd.toLocaleString()); return; } // No preference saved - show dialog myVariants.showNavigationDialog(variantChrom, variantStart, variantEnd); }, showNavigationDialog: function(chrom, start, end) { const posStr = chrom + ":" + (start+1).toLocaleString() + "-" + end.toLocaleString(); // Create dialog content const content = document.createElement("div"); // Build message with position const msg = document.createElement("p"); msg.style.marginBottom = "0.5em"; - msg.innerHTML = "Variant created at <strong>" + posStr + "</strong>"; + msg.innerHTML = "Annotation created at <strong>" + posStr + "</strong>"; content.appendChild(msg); // Show dialog with buttons $(content).dialog({ - title: "Variant Created", + title: "Annotation Created", modal: true, width: 450, buttons: { - "Go to Variant": function() { + "Go to Annotation": function() { if (document.getElementById("myVariantsRememberNav").checked) { localStorage.setItem("myVariants_navPref", "jump"); } $(this).dialog("close"); myVariants.navigateToVariant(chrom, start, end); }, "Stay Here": function() { if (document.getElementById("myVariantsRememberNav").checked) { localStorage.setItem("myVariants_navPref", "stay"); } $(this).dialog("close"); } }, open: function() { // Add checkbox to button pane, inline with buttons const dialog = $(this); const buttonPane = dialog.closest(".ui-dialog").find(".ui-dialog-buttonpane"); const checkboxSpan = document.createElement("span"); checkboxSpan.style.cssText = "display: inline-block; vertical-align: middle; margin-right: 1em;"; checkboxSpan.innerHTML = "<label><input type='checkbox' id='myVariantsRememberNav'> Remember this choice </label>"; checkboxSpan.appendChild(createInfoIcon( - "Save your preference. Future variants outside the current view will automatically " + + "Save your preference. Future annotations outside the current view will automatically " + "use this choice. Reset via Configure page or cartReset." )); // Insert before the button set buttonPane.find(".ui-dialog-buttonset").before(checkboxSpan); // Force dialog to recalculate its size dialog.dialog("option", "height", "auto"); } }); }, navigateToVariant: function(chrom, start, end) { // Add small padding around the variant (max 100bp) const padding = 100; const paddedStart = Math.max(0, start - padding); const paddedEnd = end + padding; @@ -2111,31 +2111,31 @@ "Add Highlight": function() { // Highlight selection if ($("#disableDragHighlight").prop('checked')) hgTracks.enableHighlightingDialog = false; var hlColor = $("#hlColorInput").val(); dragSelect.highlightThisRegion(newPosition, true, hlColor); $(this).dialog("close"); }, "Save Color": function() { var hlColor = $("#hlColorInput").val(); dragSelect.saveHlColor( hlColor ); $(this).dialog("close"); } }; if (typeof doMyVariants !== 'undefined' && doMyVariants) { - dragSelectButtons["Create Item"] = function() { + dragSelectButtons["Create Annotation"] = function() { let data = {}; let pos = parsePosition(newPosition); data.chrom = pos.chrom; data.start = data.thickStart = pos.start.toString(); data.end = data.thickEnd = pos.end.toString(); data.score = "0"; data.strand = "."; data.color = $("#hlColorInput").val(); data.name = ""; data.description = ""; data.ref = ""; data.alt = ""; data.trackName = "myVariants"; $(this).dialog("close"); let req = encodeURIComponent(`myVariants myVariants ${JSON.stringify(data)}`);