7f7a9a5579d7acec698c51dbf93f5030ce1a0439
braney
Tue Apr 8 15:43:17 2025 -0700
support genePred in quickLift
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 8ec8aebd78d..a37ed9bb652 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -2893,39 +2893,41 @@
break;
case cdsIncomplete: /* "incmpl" - CDS is not complete at this end */
printf("not complete
\n");
break;
case cdsComplete: /* "cmpl" - CDS is complete at this end */
printf("complete
\n");
break;
}
}
void showGenePos(char *name, struct trackDb *tdb)
/* Show gene prediction position and other info. */
{
char *rootTable = tdb->table;
char query[512];
-struct sqlConnection *conn = hAllocConn(database);
+char *liftDb = cloneString(trackDbSetting(tdb, "quickLiftDb"));
+char *db = (liftDb == NULL) ? database : liftDb;
+struct sqlConnection *conn = hAllocConn(db);
struct genePred *gpList = NULL, *gp = NULL;
char table[HDB_MAX_TABLE_STRING];
struct sqlResult *sr = NULL;
char **row = NULL;
char *classTable = trackDbSetting(tdb, GENEPRED_CLASS_TBL);
-if (!hFindSplitTable(database, seqName, rootTable, table, sizeof table, NULL))
+if (!hFindSplitTable(db, seqName, rootTable, table, sizeof table, NULL))
errAbort("showGenePos track %s not found", rootTable);
sqlSafef(query, sizeof(query), "name = \"%s\"", name);
gpList = genePredReaderLoadQuery(conn, table, query);
for (gp = gpList; gp != NULL; gp = gp->next)
{
printPos(gp->chrom, gp->txStart, gp->txEnd, gp->strand, FALSE, NULL);
if(sameString(tdb->type,"genePred")
&& startsWith("ENCODE Gencode",tdb->longLabel)
&& startsWith("ENST",name))
{
char *ensemblIdUrl = trackDbSetting(tdb, "ensemblIdUrl");
printf("Ensembl Transcript Id: ");
if (ensemblIdUrl != NULL)
printf("%s
", ensemblIdUrl,name,name);
@@ -2934,56 +2936,56 @@
}
if (gp->name2 != NULL && strlen(trimSpaces(gp->name2))> 0)
{
/* in Ensembl gene info downloaded from ftp site, sometimes the
name2 field is populated with "noXref" because there is
no alternate name. Replace this with "none" */
printf("Gene Symbol:");
if ((strlen(gp->name2) < 1) || (sameString(gp->name2, "noXref")))
printf(" none
\n");
else
printf(" %s
\n",gp->name2);
}
char *ensemblSource = NULL;
if (sameString("ensGene", table))
{
- if (hTableExists(database, "ensemblSource"))
+ if (hTableExists(db, "ensemblSource"))
{
sqlSafef(query, sizeof(query),
"select source from ensemblSource where name='%s'", name);
ensemblSource = sqlQuickString(conn, query);
}
}
if ((gp->exonFrames != NULL) && (!genbankIsRefSeqNonCodingMRnaAcc(gp->name)))
{
if (ensemblSource && differentString("protein_coding",ensemblSource))
{
printf("CDS Start: none (non-coding)
\n");
printf("CDS End: none (non-coding)
\n");
}
else
{
printf("CDS Start: ");
printCdsStatus((gp->strand[0] == '+') ? gp->cdsStartStat : gp->cdsEndStat);
printf("CDS End: ");
printCdsStatus((gp->strand[0] == '+') ? gp->cdsEndStat : gp->cdsStartStat);
}
}
/* if a gene class table exists, get gene class and print */
if (classTable != NULL)
{
- if (hTableExists(database, classTable))
+ if (hTableExists(db, classTable))
{
sqlSafef(query, sizeof(query),
"select class from %s where name = \"%s\"", classTable, name);
sr = sqlGetResult(conn, query);
/* print class */
if ((row = sqlNextRow(sr)) != NULL)
printf("Prediction Class: %s
\n", row[0]);
sqlFreeResult(&sr);
if (sqlFieldIndex(conn, classTable, "level") > 0 )
{
sqlSafef(query, sizeof(query),
"select level from %s where name = \"%s\"", classTable, name);
sr = sqlGetResult(conn, query);
if ((row = sqlNextRow(sr)) != NULL)
printf("Level:  %s
\n", row[0]);
@@ -11696,32 +11698,34 @@
prGRShortRefGene(row[0]);
}
}
sqlFreeResult(&sr);
}
showOmimDisorderTable(conn, url, itemName);
}
printf(""); // #omimText
}
static void printOmimLocationDetails(struct trackDb *tdb, char *itemName, boolean encode)
/* Print details of an OMIM Class 3 Gene entry. */
{
-struct sqlConnection *conn = hAllocConn(database);
-struct sqlConnection *conn2 = hAllocConn(database);
+char *liftDb = cloneString(trackDbSetting(tdb, "quickLiftDb"));
+char *db = (liftDb == NULL) ? database : liftDb;
+struct sqlConnection *conn = hAllocConn(db);
+struct sqlConnection *conn2 = hAllocConn(db);
char query[256];
struct sqlResult *sr;
char **row;
char *url = tdb->url;
char *kgId = NULL;
char *title1 = NULL;
char *geneSymbol = NULL;
char *chrom, *chromStart, *chromEnd;
char *kgDescription = NULL;
char *refSeq;
char *omimId;
chrom = cartOptionalString(cart, "c");
chromStart = cartOptionalString(cart, "o");
chromEnd = cartOptionalString(cart, "t");
@@ -11923,31 +11927,33 @@
printf("