4f0b12aadc3153194c9b4c81c70adc86d621ff2b
braney
  Fri Oct 10 12:08:26 2025 -0700
support genePred in quickLift

diff --git src/hg/hgTracks/gencodeTracks.c src/hg/hgTracks/gencodeTracks.c
index 78021835d5f..2c52d8b6bde 100644
--- src/hg/hgTracks/gencodeTracks.c
+++ src/hg/hgTracks/gencodeTracks.c
@@ -343,31 +343,35 @@
 static struct sqlResult *executeQuery(struct sqlConnection *conn, struct gencodeQuery *gencodeQuery)
 /* execute the actual SQL query */
 {
 struct dyString *query = dyStringNew(0);
 sqlDyStringPrintf(query, "select %-s from %-s where %-s", 
     dyStringContents(gencodeQuery->fields), dyStringContents(gencodeQuery->from), dyStringContents(gencodeQuery->where));
 struct sqlResult *sr = sqlGetResult(conn, dyStringContents(query));
 dyStringFree(&query);
 return sr;
 }
 
 static boolean annotIsGenePredExt(struct track *tg)
 /* determine if a table has genePred extended fields.  two-way consensus
  * pseudo doesn't have them. */
 {
-struct sqlConnection *conn = hAllocConn(database);
+char *db = database;
+char *liftDb = cloneString(trackDbSetting(tg->tdb, "quickLiftDb"));
+if (liftDb)
+    db = liftDb;
+struct sqlConnection *conn = hAllocConn(db);
 struct slName *fields = sqlFieldNames(conn, tg->table);
 hFreeConn(&conn);
 boolean isGenePredX = slNameInList(fields, "score");
 slFreeList(&fields);
 return isGenePredX;
 }
 
 static void geneQueryAddGenePredCols(struct track *tg,
                                      struct gencodeQuery *gencodeQuery)
 /* add genePred columns to query */
 {
 gencodeQuery->isGenePredX = annotIsGenePredExt(tg);
 sqlDyStringPrintf(gencodeQuery->fields, "g.name, g.chrom, g.strand, g.txStart, g.txEnd, g.cdsStart, g.cdsEnd, g.exonCount, g.exonStarts, g.exonEnds");
 gencodeQuery->genePredNumColumns = GENEPRED_NUM_COLS;
 
@@ -551,31 +555,35 @@
 struct wgEncodeGencodeAttrs *attrs = gencodeQueryAttrs(gencodeQuery, row);  // maybe NULL
 struct linkedFeatures *lf = linkedFeaturesFromGenePred(tg, gp, TRUE);
 if (highlightIds != NULL)
     highlightByGetColor(gp, highlightIds, highlightColor, lf);
 if (gencodeQuery->isGenePredX)
     lf->extra = getTranscriptLabel(enabledLabels, gp, attrs);
 else
     lf->extra = cloneString(gp->name);
 wgEncodeGencodeAttrsFree(&attrs);
 return lf;
 }
 
 static void loadGencodeTrack(struct track *tg)
 /* Load genePreds in window info linked feature, with filtering, etc. */
 {
-struct sqlConnection *conn = hAllocConn(database);
+char *db = database;
+char *liftDb = cloneString(trackDbSetting(tg->tdb, "quickLiftDb"));
+if (liftDb)
+    db = liftDb;
+struct sqlConnection *conn = hAllocConn(db);
 unsigned enabledLabels = getEnabledLabels(tg);
 boolean needAttrs = (enabledLabels & ITEM_LABEL_GENE_ID) != 0;  // only for certain labels
 struct hash *highlightIds = NULL;
 if (anyFilterBy(tg, highlightBySetGet))
     highlightIds = loadHighlightIds(conn, tg);
 struct gencodeQuery *gencodeQuery = geneQueryConstruct(conn, tg, needAttrs);
 struct sqlResult *sr = executeQuery(conn, gencodeQuery);
 struct linkedFeatures *lfList = NULL;
 unsigned highlightColor = getHighlightColor(tg);
 char **row;
 while ((row = sqlNextRow(sr)) != NULL)
     slAddHead(&lfList, loadGencodeTranscript(tg, gencodeQuery, row, enabledLabels, highlightIds, highlightColor));
 sqlFreeResult(&sr);
 hFreeConn(&conn);
 
@@ -591,30 +599,35 @@
 }
 
 static char *gencodeGeneName(struct track *tg, void *item)
 /* Get name to use for Gencode gene item. */
 {
 struct linkedFeatures *lf = item;
 if (lf->extra != NULL)
     return lf->extra;
 else
     return lf->name;
 }
 
 static void gencodeGeneMethods(struct track *tg)
 /* Load up custom methods for ENCODE Gencode gene track */
 {
+char *liftDb = cloneString(trackDbSetting(tg->tdb, "quickLiftDb"));
+extern void loadGenePredWithName2(struct track *tg);
+if (liftDb)
+    tg->loadItems = loadGenePredWithName2;
+else
     tg->loadItems = loadGencodeTrack;
 tg->itemName = gencodeGeneName;
 }
 
 static void registerProductionTrackHandlers()
 /* register track handlers for production GENCODE tracks */
 {
 // ENCODE 1 legacy
 registerTrackHandler("wgEncodeSangerGencode", gencodeGeneMethods);
 
 // uses trackHandler attribute
 registerTrackHandler("wgEncodeGencode", gencodeGeneMethods);
 
 }