b2f9be0b91398f9c55f0eea01dbaded5d164f562 braney Sun May 24 15:07:28 2015 -0700 get GENCODE ID from knownGene table if Gencode models #14639 diff --git src/hg/hgGene/hgGene.c src/hg/hgGene/hgGene.c index 7c860ea..b355b29 100644 --- src/hg/hgGene/hgGene.c +++ src/hg/hgGene/hgGene.c @@ -587,49 +587,53 @@ "select chrom,txStart,txEnd from %s where name = '%s'" , table, curGeneId); sr = sqlGetResult(conn, query); row = sqlNextRow(sr); if (row != NULL) { curGeneChrom = cloneString(row[0]); curGeneStart = atoi(row[1]); curGeneEnd = atoi(row[2]); } else hUserAbort("Couldn't find %s in %s.%s", curGeneId, database, table); sqlFreeResult(&sr); } -struct genePred *getCurGenePred(struct sqlConnection *conn) +static struct genePred *getCurGenePred(struct sqlConnection *conn) /* Return current gene in genePred. */ { char *track = genomeSetting("knownGene"); char table[64]; boolean hasBin; char query[256]; struct sqlResult *sr; char **row; struct genePred *gp = NULL; hFindSplitTable(sqlGetDatabase(conn), curGeneChrom, track, table, &hasBin); +bool hasAttrId = sqlColumnExists(conn, table, "alignId"); sqlSafef(query, sizeof(query), "select * from %s where name = '%s' " "and chrom = '%s' and txStart=%d and txEnd=%d" , table, curGeneId, curGeneChrom, curGeneStart, curGeneEnd); sr = sqlGetResult(conn, query); if ((row = sqlNextRow(sr)) != NULL) { gp = genePredLoad(row + hasBin); + + if (hasAttrId) + curAlignId = cloneString(row[11]); } sqlFreeResult(&sr); if (gp == NULL) errAbort("getCurGenePred: Can't find %s", query); return gp; } void doKgMethod() /* display knownGene.html content (UCSC Known Genes * Method, Credits, and Data Use Restrictions) */ { cartWebStart(cart, database, "Methods, Credits, and Use Restrictions"); struct trackDb *tdb = hTrackDbForTrack(database, genomeSetting("knownGene")); hPrintf("%s", tdb->html); cartWebEnd();