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/hg/hgTracks/hgTracks.h src/hg/hgTracks/hgTracks.h
index 1637adb89ca..c995bd75029 100644
--- src/hg/hgTracks/hgTracks.h
+++ src/hg/hgTracks/hgTracks.h
@@ -371,30 +371,33 @@
     float priority;        /* Display order, 0 is on top. */
     float defaultPriority; /* original priority before reordering */
     struct trackRef *trackList;  /* List of tracks. */
     boolean defaultIsClosed; /* close the track group by default. */
     char *errMessage;      /* any error messages that came up during trackDb parsing. */
     };
 
 struct simpleFeature
 /* Minimal feature - just stores position in browser coordinates. */
     {
     struct simpleFeature *next;
     int start, end;			/* Start/end in browser coordinates. */
     int qStart, qEnd;			/* query start/end */
     int grayIx;                         /* Level of gray usually. */
     int codonIndex;                     /* 1-based codon index (ignored if 0) */
+    char codonAa;                       /* For a codon, its display amino-acid letter:
+                                         * AA letter, '*' stop, 'M' start, 'X' error/partial,
+                                         * 0 if not a codon.  Set when grayIx is. */
     };
 
 /* Some details of how to draw linked features. */
 enum {lfSubXeno = 1};
 enum {lfSubSample = 2};
 enum {lfWithBarbs = 3}; /* Turn on barbs to show direction based on
                          * strand field */
 enum {lfSubChain = 4};
 enum {lfNoIntronLines = 5}; /* Draw no lines between exon blocks */
 
 enum highlightMode
     {
     highlightNone=0,
     highlightBackground=1,
     highlightOutline=2