2654a3d85847492877e5d2b48d921a292e991771
braney
  Thu May 7 09:40:26 2026 -0700
hgConvert quickLift: fix subtrack selection, hgc Predicted Protein /
CDS FASTA links

Three remaining issues on this ticket:

(vii) After "+ Select all subtracks" on hg38 refSeqComposite then
quickLifting to hs1, only RefSeq Curated rendered.  dumpTdbAndChildren
built buffer="<track>_sel" but then read cart[tdb->track] (the visibility,
not the checkbox state); the visibility is never "1", so every subtrack
emitted "parent <comp> off" and only trackDb-default-on subtracks
rendered.  Read cart[buffer] and accept any cartUsualBoolean-true value
("on" or positive int).

Predicted Protein blank page on quickLifted refGene:
getGenePredForPositionSql passed the hub-prefixed tdb->table to
quickLiftSql, which then queried the source DB (hg38) for a
"hub_NNN_refGene" table that doesn't exist.  Strip the prefix with
trackHubSkipHubName before the source-DB query.  Also, doRefGene was
overriding pepName to rl->mrnaAcc for every quickLifted item, so for
non-coding NR_* the mrnaAcc matched gbSeq and we offered a Predicted
Protein link that htcTranslatedPredMRna can only abort on.  Only
override pepName for coding mRNAs; non-coding falls through to the
existing "Non-protein coding gene..." message.

CDS FASTA "Unknown database hub_NNN_<db>": addPalLink generates an hgPal
URL with no db=, so hgPal tries to open the destination hub-virtual db
and dies.  palInfo coords are in destination space anyway while the
multiZ alignment lives in source coords, so skip addPalLink for
quickLifted tracks.

refs #36125

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 41dba1418d8..df84bcab6b2 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -3251,31 +3251,34 @@
 puts("<LI>\n");
 hgcAnchorSomewhere(mrnaClick, geneName, geneTable, seqName);
 /* hack to put out a correct message describing the mRNA */
 if (sameString(mrnaClick, "htcGeneMrna"))
     printf("%s</A> from genomic sequences\n", mrnaDescription);
 else
     printf("%s</A> (may be different from the genomic sequence)\n",
            mrnaDescription);
 puts("</LI>\n");
 
 puts("<LI>\n");
 hgcAnchorSomewhere(genomicClick, geneName, geneTable, seqName);
 printf("Genomic Sequence</A> from assembly\n");
 puts("</LI>\n");
 
-if (palInfo)
+// Skip the CDS FASTA alignment link for quickLifted tracks: hgPal would try
+// to open the destination's hub-virtual db, and palInfo coords are in
+// destination space while the multiZ alignment lives in source coords.
+if (palInfo && liftDb == NULL)
     {
     struct sqlConnection *conn = hAllocConn(srcDb);
     addPalLink(conn, tdb->track,  palInfo->chrom, palInfo->left,
         palInfo->right, palInfo->rnaName);
     hFreeConn(&conn);
     }
 
 printf("</UL>\n");
 }
 
 void geneShowPosAndLinks(char *geneName, char *pepName, struct trackDb *tdb,
 			 char *pepTable, char *pepClick,
 			 char *mrnaClick, char *genomicClick, char *mrnaDescription)
 {
 geneShowPosAndLinksPal(geneName, pepName, tdb,
@@ -9645,31 +9648,31 @@
     db = liftDb;
 struct sqlConnection *conn = hAllocConn(db);
 struct sqlResult *sr;
 char **row;
 struct genePred *gp;
 int rowOffset = hOffsetPastBin(db, seqName, tdb->table);
 if (liftDb != NULL)
     {
     char *table;
     if (isCustomTrack(tdb->table))
         {
         liftDb = CUSTOM_TRASH;
         table = trackDbSetting(tdb, "dbTableName");
         }
     else
-        table = tdb->table;
+        table = trackHubSkipHubName(tdb->table);
     struct hash *chainHash = newHash(8);
     struct sqlConnection *conn = hAllocConn(liftDb);
 
 // using this loader on genePred tables with less than 15 fields may be a problem.
 extern struct genePred *genePredExtLoad15(char **row);
 
     char extraWhere[4096];
     sqlSafef(extraWhere, sizeof extraWhere, "name = \"%s\"", geneName);
     gpList = (struct genePred *)quickLiftSql(conn, quickLiftFile, table, seqName, winStart, winEnd,  NULL, extraWhere, (ItemLoader2)genePredExtLoad15, 0, chainHash);
     hFreeConn(&conn);
 
     calcLiftOverGenePreds( gpList, chainHash, 0.0, 0.0, TRUE, NULL, NULL,  TRUE, FALSE);
     }
 else
     {
@@ -13798,37 +13801,41 @@
 
 if (genbankIsRefSeqCodingMRnaAcc(rnaName))
     {
     AllocVar(palInfo);
     palInfo->chrom = chrom;
     palInfo->left = left;
     palInfo->right = right;
     palInfo->rnaName = rnaName;
     }
 
 // For quickLifted tracks, route the Predicted Protein/mRNA links to the
 // genome-derived handlers so the sequences reflect the destination
 // assembly at the lifted exon coordinates, rather than the NCBI-authored
 // sequence that lives with the source refPep/refMrna extFiles.
 // htcTranslatedPredMRna keys on the transcript name rather than the
-// protein accession, so swap the pepName for that case.
+// protein accession, so swap the pepName for that case.  For non-coding
+// transcripts (NR_*) leave pepName as the empty protAcc, otherwise gbSeq
+// would match the mrnaAcc and we'd offer a Predicted Protein link that
+// htcTranslatedPredMRna can only abort on.
 char *pepClick = "htcTranslatedProtein";
 char *pepName = rl->protAcc;
 char *mrnaClick = "htcRefMrna";
 if (liftDb != NULL)
     {
     pepClick = "htcTranslatedPredMRna";
+    if (genbankIsRefSeqCodingMRnaAcc(rnaName))
         pepName = rl->mrnaAcc;
     mrnaClick = "htcGeneMrna";
     }
 geneShowPosAndLinksPal(rl->mrnaAcc, pepName, tdb, refPepTable, pepClick,
 		    mrnaClick, "htcGeneInGenome", "mRNA Sequence",palInfo);
 
 printTrackHtml(tdb);
 hFreeConn(&conn);
 }
 
 char *kgIdToSpId(struct sqlConnection *conn, char* kgId)
 /* get the swissprot id for a known genes id; resulting string should be
  * freed */
 {
 char query[512];