4aa77873cb618e254b2f90d091d7bdef844947c2
max
  Wed Jul 8 04:28:42 2026 -0700
Let assembly hubs assign genetic codes per sequence for amino acid display

Adds a "codonTable" genomes.txt setting, e.g. "codonTable default=1
NC_017929.1=13", so an assembly hub can pick the NCBI translation table used to
show amino acids for each sequence.  New hGeneticCodeForChrom(db, chrom) in
hdb.c resolves the code (per-db cached), falling back to the previous behavior:
chrM/chrMT use the vertebrate mitochondrial code, everything else the standard
code.

Wired into the two browser display paths, which both go through cds.c's
baseColorLookupCodon: the base position track three-frame translation and
codon-colored annotation tracks such as gene predictions (also PSL/BAM).  Also
used for the hgc SNP amino acid details, and genePredTranslate gains a db
parameter (genePredToProt gains an optional -db flag) so command-line
translation can honor the same setting.  Documented in assemblyHubHelp.html.
refs #16550

diff --git src/hg/inc/hdb.h src/hg/inc/hdb.h
index 520849418c0..e604aebfea5 100644
--- src/hg/inc/hdb.h
+++ src/hg/inc/hdb.h
@@ -1067,30 +1067,37 @@
 
 boolean hDbHasNcbiRefSeqHistorical(char *db);
 /* Return TRUE if db has NCBI's Historical RefSeq alignments and annotations. */
 
 char *hRefSeqAccForChrom(char *db, char *chrom);
 /* Return the RefSeq NC_000... accession for chrom if we can find it, else just chrom.
  * db must never change. */
 
 char *abbreviateRefSeqSummary(char *summary);
 /* strip off the uninformative parts from the RefSeq Summary text: the repetitive note
  * about the publication subset and the Evidence-Data-Notes */
 
 boolean isMito(char *chrom);
 /* Return True if chrom is chrM or chrMT */
 
+struct geneticCode *hGeneticCodeForChrom(char *db, char *chrom);
+/* Return the genetic code (translation table) to use for chrom in db.  An
+ * assembly hub may assign codes per sequence with a genomes.txt line like
+ * "codonTable default=1 chrM=2".  For backward compatibility, when no such
+ * assignment applies, chrM/chrMT use the vertebrate mitochondrial code and all
+ * other sequences use the standard code.  Never returns NULL. */
+
 char *hdbDefaultKnownDb(char *db);
 /* Get the default knownGene database from the defaultKnown table. */
 
 char *hdbGetMasterGeneTrack(char *knownDb);
 /* Get the native gene track for a knownGene database. */
 
 boolean trackDataAccessibleHash(char *database, struct trackDb *tdb, struct hash *gbdbHash);
 /* Return TRUE if underlying data are accessible - meaning the track has either
  * a bigDataUrl with remote URL (http:// etc), a bigDataUrl with an existing local file,
  * or a database table with the same name.
  * Note: this returns FALSE for composite tracks; use this on subtracks or simple tracks. 
  *
  * if gbdbHash is not NULL, use it when looking for the file */
 
 unsigned hdbGetTrackCartVersion();