02710f0107a6b154d9e5689165941ce724cb4c6a braney Fri Sep 4 13:38:54 2026 -0700 quickLift: fix the seams a second review pass found quickLiftPslBackToProtein left two things wrong. pslTransMap can hand back strand[0] == '-', because it reverse complements the input when the two alignments disagree about the strand of the sequence they share, and forcing strand[1] to '+' on top of that produced "-+". A protein psl is only ever "++" or "+-", and pslShow reads strand[0] == '-' as "reverse complement the query", so it would have reverse complemented a protein as though it were DNA. It now turns the alignment over so the minus lands on the target side. qBaseInsert is in nucleotides like everything else being divided, so it comes down too, and it joins the divisibility guard: without it the result failed pslCheck and the number was printed verbatim on the details page. Adding that back-conversion made a comment in pslTrack.c false. The lift no longer always returns an untranslated alignment, so the drawing code has to ask rather than assume, the way bigBedTrack.c already did. A quickLifted protein psl track was drawing every block at a third of its length. No such track exists on hg19 or hg38 today, so this was latent. The normalized score on the chain details page was read from the assembly on screen. Where that assembly has no such table the page died; where it has a table of the same name, which is the common case for a self or a well known chain track, it silently returned some other assembly's chain and printed a blank score. It now reads the assembly the chain came from, on a connection to it. Two smaller things: htcBigPslAli guarded its connection with trackHubDatabase alone, but a GenArk accession does not start with hub_, so it matches the guard genericClickHandlerPlus already uses; and the table name tests in cds.c now skip the hub prefix the way the ones in hgc.c were changed to, so a lifted refSeqAli reaches its special case. The chain item label took its start from the source chain and its strand character from the lifted one. Both now come from the source chain. refs #38249 diff --git src/hg/hgTracks/cds.c src/hg/hgTracks/cds.c index 484711d074a..7c5a9483cc5 100644 --- src/hg/hgTracks/cds.c +++ src/hg/hgTracks/cds.c @@ -6,30 +6,31 @@ #include "common.h" #include "hCommon.h" #include "hash.h" #include "jksql.h" #include "memalloc.h" #include "dystring.h" #include "memgfx.h" #include "hvGfx.h" #include "dnaseq.h" #include "dnautil.h" #include "hdb.h" #include "psl.h" #include "fa.h" #include "genePred.h" #include "cds.h" +#include "trackHub.h" #include "genbank.h" #include "twoBit.h" #include "cacheTwoBit.h" #include "hgTracks.h" #include "cdsSpec.h" #include "axt.h" #include "lrg.h" /* * WARNING: this code is incomprehensible: * - variables named codon often contain amino acids, not condons * - it does two passes, one undocumented function encodes both a * color and an amino acid into the struct simpleFeature grayIx * field and this is decoded in the second pass. * - baseColorDrawItem doesn't draw a item, it draws a single codon, @@ -1168,31 +1169,34 @@ } static struct dnaSeq *maybeGetSeqUpper(struct linkedFeatures *lf, char *mrnaName, int mrnaStart, int mrnaEnd, char *tableName, struct track *tg, boolean doRc, int *retMrnaOffset) /* Look up the sequence in genbank tables (hGenBankGetMrna also searches * seq if it can't find it in GB tables) or user's blat sequence, * uppercase and return it if we find it, return NULL if we don't find it. */ { boolean doUpper = TRUE; struct dnaSeq *mrnaSeq = NULL; char *name = getItemDataName(tg, mrnaName); // The sequence the alignment is to belongs with the alignment, so on a quickLifted track // it comes from the assembly the alignment came from, not the one on screen. char *seqDb = cdsDb(tg); -if (sameString(tableName,"refGene") || sameString(tableName,"refSeqAli")) +// A quickLifted track arrives with a hub_NNN_ prefix, and these tests are about what kind +// of table it is, so they want the name without it. +char *bareTable = trackHubSkipHubName(tableName); +if (sameString(bareTable,"refGene") || sameString(bareTable,"refSeqAli")) mrnaSeq = hGenBankGetMrna(seqDb, name, "refMrna"); else { char *seqSource = trackDbSetting(tg->tdb, BASE_COLOR_USE_SEQUENCE); if (seqSource != NULL) { if (sameString(seqSource, "ss")) mrnaSeq = maybeGetUserSeq(name); #ifndef GBROWSE else if (sameString(seqSource, PCR_RESULT_TRACK_NAME)) mrnaSeq = maybeGetPcrResultSeq(lf); #endif /* GBROWSE */ else if (startsWith("extFile", seqSource)) mrnaSeq = maybeGetExtFileSeq(seqDb, seqSource, name); else if (endsWith("ExtFile", seqSource))