1d851880b8a9d745cfed02d9e7893c210fd7bc70
braney
  Wed May 24 13:56:28 2017 -0700
print out Gencode Gene Id if Gencode version of knownGene

diff --git src/hg/hgGene/hgGene.c src/hg/hgGene/hgGene.c
index 3e1774c..97406c4 100644
--- src/hg/hgGene/hgGene.c
+++ src/hg/hgGene/hgGene.c
@@ -235,47 +235,58 @@
 	    if (genomeOptionalSetting("summaryIdSql"))
 	        {
 		char *summaryId = genoQuery(id, "summaryIdSql", conn);
 		if (summaryId != NULL)
 		    dyStringPrintf(description, " (%s)", summaryId);
 		}
 	    dyStringPrintf(description, ":</B> %s", summary);
 	    freez(&summary);
 	    dyStringPrintf(description, "<BR>\n");
 	    }
 	}
     }
 return dyStringCannibalize(&description);
 }
 
+static char *getGencodeGeneId(struct sqlConnection *conn, char *id, char *buffer, int bufSize)
+{
+char query[256];
+sqlSafef(query, sizeof(query), "select protein from knownCanonical c, knownIsoforms i where i.clusterId=c.clusterId and i.transcript='%s'" ,id);
+return sqlQuickQuery(conn, query, buffer, bufSize );
+}
+
 static void printDescription(char *id, struct sqlConnection *conn, struct trackDb *tdb)
 /* Print out description of gene given ID. */
 {
 char *description = descriptionString(id, conn);
 int  i, exonCnt = 0, cdsExonCnt = 0;
 int  cdsStart, cdsEnd;
 
 hPrintf("%s", description);
 freez(&description);
 
 /* print genome position and size */
 char buffer[1024];
 char *commaPos;
 char *isGencode = trackDbSetting(tdb, "isGencode");
    
 if (isGencode)
+    {
     hPrintf("<B>Gencode Transcript:</B> %s<br>\n", curAlignId);
+    char buffer[1024];
+    hPrintf("<B>Gencode Gene:</B> %s<br>\n", getGencodeGeneId(conn, curGeneId, buffer, sizeof buffer));
+    }
 exonCnt = curGenePred->exonCount;
 safef(buffer, sizeof buffer, "%s:%d-%d", curGeneChrom, curGeneStart+1, curGeneEnd);
 commaPos = addCommasToPos(database, buffer);
 
 hPrintf("<B>Transcript (Including UTRs)</B><br>\n");
 hPrintf("<B>&nbsp;&nbsp;&nbsp;Position:</B>&nbsp;%s %s&nbsp;",database, commaPos);
 sprintLongWithCommas(buffer, (long long)curGeneEnd - curGeneStart);
 hPrintf("<B>Size:</B>&nbsp;%s&nbsp;", buffer);
 hPrintf("<B>Total Exon Count:</B>&nbsp;%d&nbsp;", exonCnt);
 hPrintf("<B>Strand:</B>&nbsp;%s<br>\n",curGenePred->strand);
 
 cdsStart = curGenePred->cdsStart;
 cdsEnd = curGenePred->cdsEnd;
 
 /* count CDS exons */