6d437c28a5ff82a2af59ca516559053c4bf7c3f9 max Thu Jun 18 01:18:34 2026 -0700 hgTracks: amino-acid name in codon + ruler mouseovers; exon-length label; ruler "Complement bases" config toggle Three genome browser display changes around AA display: 1) amino acids shown on genePred codons and on rule codons, and making the "complement option" easier to find. 1) The genePred/bigGenePred codon mouseover (zoomed to the codon level) now shows the codon's amino acid on its own "Amino acid:" line, as the three-letter abbreviation plus full name (e.g. "Ala (alanine)"). Rather than reverse-decode the amino acid out of the codon's packed grayIx, the one-letter code is now stored on the codon when it is translated: struct simpleFeature gains a codonAa field, codonToGrayIx() reports the letter through a new out-param, and the codon mouseover reads simpleFeature.codonAa directly. The drawn codon letter and the mouseover then derive from the same translation and cannot drift apart, without the mouseover having to understand the grayIx encoding (the drawing path, colorAndCodonFromGrayIx(), still decodes its own grayIx inline, unchanged). Adds a one-letter->full-name aaToName() in lib/dnautil.c (using the previously unused name field of aminoAcidTable). Stop codons show "Ter (termination)". Also relabels the exon "Length" field as "Exon Length" in the codon and zoomed-out exon mouseovers; introns keep "Length". 2) The base-position ruler's three-reading-frame translation (hgt.baseShowCodons) now gives each codon box a mouse-over with the same three-letter abbreviation and full name, reading the stored codonAa via aaToName()/aaToAbbr() (baseColorDrawRulerCodons in cds.c). 3) Adds a "Complement the bases" checkbox to the base position (ruler) track configuration page (hgTrackUi rulerUi). It toggles the same per-assembly COMPLEMENT_BASES_VAR cart variable that was previously reachable only by clicking the "Click to complement" arrow next to the ruler. Also fixes the indentation of the adjacent drawComplementArrow() text assignments. refs #37779 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> diff --git src/lib/dnautil.c src/lib/dnautil.c index 56c46142460..5e27251f5a2 100644 --- src/lib/dnautil.c +++ src/lib/dnautil.c @@ -1217,30 +1217,44 @@ char aaUC = toupper(aa); int ix; for (ix = 0; ix < ArraySize(aminoAcidTable); ix++) { if (aaUC == aminoAcidTable[ix].letter) { // safencpy(...3) is required here because aminoAcidTable.abbreviation is char[3] not [4] safencpy(abbrBuf, abbrBufSize, aminoAcidTable[ix].abbreviation, 3); abbrBuf[0] = toupper(abbrBuf[0]); return; } } safef(abbrBuf, abbrBufSize, "?%c?", aa); } +char *aaToName(char aa) +/* Convert an AA single letter such as 'A', 'D' etc. to its full name such as "alanine", + * "aspartic acid" etc. Returns NULL if aa is not found. */ +{ +char aaUC = toupper(aa); +int ix; +for (ix = 0; ix < ArraySize(aminoAcidTable); ix++) + { + if (aaUC == aminoAcidTable[ix].letter) + return aminoAcidTable[ix].name; + } +return NULL; +} + void trimRefAltDir(char *ref, char *alt, uint *pStart, uint *pEnd, int *pRefLen, int *pAltLen, boolean leftJustify) /* If ref and alt have identical bases at beginning and/or end, trim those & update all params. */ { int trimStart = 0, trimEnd = 0; int refLen = strlen(ref); int altLen = strlen(alt); if (leftJustify) { // first trim end, then start while (refLen > 0 && altLen > 0 && ref[refLen-1] == alt[altLen-1]) { (*pEnd)--; refLen--; altLen--;