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/genePred.h src/hg/inc/genePred.h index 9d5a3c93c07..12eceb05a9e 100644 --- src/hg/inc/genePred.h +++ src/hg/inc/genePred.h @@ -387,34 +387,36 @@ struct genePredExt *genePredFromBigGenePred( char *chrom, struct bigBedInterval *bb); /* build a genePred from a bigGenePred interval */ struct genePredExt *genePredFromBigGenePredRow(char **row); /* build a genePred from a bigGenePred row */ /* options to genePredTranslate */ #define GENEPRED_TRANSLATE_SELENO 0x01 /* Assume internal TGA code for selenocysteine and translate to `U' */ #define GENEPRED_TRANSLATE_INCLUDE_STOP 0x02 /* If the CDS ends with a stop codon, represent it as a `*' */ #define GENEPRED_TRANSLATE_STAR_INFRAME_STOPS 0x04 /* Use `*' instead of `X' for in-frame stop codons. * This will result in selenocysteine's being `*', with only codons * containing `N' being translated to `X'. This doesn't include terminal * stop */ void genePredTranslate(struct genePred *gp, struct nibTwoCache* genomeSeqs, unsigned options, - char **protRet, char **cdsRet); + char *db, char **protRet, char **cdsRet); /* Translate a genePred into a protein. It can also return the CDS part of the - * mRNA sequence. If the chrom is chrM, the mitochondrial translation tables are - * used. If protRet or cdsRet is NULL, those sequences are not returned. + * mRNA sequence. The genetic code is that assigned to gp->chrom in db (an + * assembly hub may set this; chrM/chrMT default to the mitochondrial code). + * db may be NULL, in which case only the chrM/chrMT default applies. + * If protRet or cdsRet is NULL, those sequences are not returned. */ void genePredToCds(struct genePred *gp, struct genbankCds *cds); /* Fill in cds with transcript offsets computed from genePred. */ struct psl *genePredToPsl(struct genePred *gp, int chromSize, int qSize); /* Convert a genePred to psl, assuming perfect concordance between target & query. * If qSize is 0 then the number of aligned bases will be used as qSize. */ struct genePredExt *genePredFromBedBigGenePred( char *chrom, struct bed *bed, struct bigBedInterval *bb, boolean changedStrand); /* build a genePred from a bigGenePred and a bed file */ struct genePred *genePredExtLoad15(char **row); /* Load a genePred record assumed to be 15 fields. */