e19de49c3685111d42c4e5cf7a8be2130d2ef3d8 markd Wed Dec 28 09:31:19 2011 -0800 added annotation level to gencode details page diff --git src/hg/hgc/gencodeClick.c src/hg/hgc/gencodeClick.c index 973c429..099c211 100644 --- src/hg/hgc/gencodeClick.c +++ src/hg/hgc/gencodeClick.c @@ -109,53 +109,67 @@ static char *getMethodDesc(char *source) /* return the annotation method name based gene or transcript source */ { // looks for being havana and/or ensembl // classifies other sources as automatic (mt_genbank_import ncrna ncrna_pseudogene) bool hasHav = containsStringNoCase(source, "havana") != NULL; bool hasEns = containsStringNoCase(source, "ensembl") != NULL; if (hasHav && hasEns) return "manual & automatic"; else if (hasHav) return "manual"; else return "automatic"; } +static char *getLevelDesc(int level) +/* return english description for level */ +{ +if (level == 1) + return "validated"; +else if (level == 2) + return "manual"; +else if (level == 3) + return "automatic"; +else + return "unknown"; +} + static char *mkExtIdUrl(struct trackDb *tdb, char *id, char *settingName, char *urlBuf) /* generate a url to a external database given an id and the name of a setting * containing the sprintf URL template.*/ { safef(urlBuf, urlBufSize, trackDbRequiredSetting(tdb, settingName), id); return urlBuf; } static void prExtIdAnchor(struct trackDb *tdb, char *id, char *settingName) /* if an id to an external database is not empty, print an HTML anchor to it */ { char urlBuf[urlBufSize]; if (!isEmpty(id)) printf("<a href=\"%s\" target=_blank>%s</a>", mkExtIdUrl(tdb, id, settingName, urlBuf), id); } static void prTdExtIdAnchor(struct trackDb *tdb, char *id, char *settingName) /* print a table data element with an anchor for a id */ { printf("<td>"); prExtIdAnchor(tdb, id, settingName); } + static void writePosLink(char *chrom, int chromStart, int chromEnd) /* write link to a genomic position */ { printf("<a href=\"%s&db=%s&position=%s%%3A%d-%d\" target=_blank>%s:%d-%d</A>", hgTracksPathAndSettings(), database, chrom, chromStart, chromEnd, chrom, chromStart+1, chromEnd); } static void writeBasicInfoHtml(struct trackDb *tdb, char *gencodeId, struct genePred *transAnno, struct wgEncodeGencodeAttrs *transAttrs, int geneChromStart, int geneChromEnd, struct wgEncodeGencodeGeneSource *geneSource, struct wgEncodeGencodeTranscriptSource *transcriptSource) /* write basic HTML info for all genes */ { /* * notes: @@ -180,31 +194,32 @@ // FIXME: white-space style should be in CCS, but don't want to risk breaking // other things. printf("<tr><th>Position"); printf("<td style=\"white-space: nowrap;\">"); writePosLink(transAnno->chrom, transAnno->txStart, transAnno->txEnd); printf("<td style=\"white-space: nowrap;\">"); writePosLink(transAnno->chrom, geneChromStart, geneChromEnd); printf("</tr>\n"); printf("<tr><th>Strand<td>%s<td></tr>\n", transAnno->strand); printf("<tr><th><a href=\"http://www.gencodegenes.org/gencode_biotypes.html\">Biotype</a><td>%s<td>%s</tr>\n", transAttrs->transcriptType, transAttrs->geneType); /* FIXME: add href o */ printf("<tr><th>Status<td>%s<td>%s</tr>\n", transAttrs->transcriptStatus, transAttrs->geneStatus); -printf("<tr><th>Method<td>%s<td>%s</tr>\n", getMethodDesc(transcriptSource->source), getMethodDesc(geneSource->source)); +printf("<tr><th>Annotation Level<td>%s (%d)<td></tr>\n", getLevelDesc(transAttrs->level), transAttrs->level); +printf("<tr><th>Annotation Method<td>%s<td>%s</tr>\n", getMethodDesc(transcriptSource->source), getMethodDesc(geneSource->source)); printf("<tr><th>HUGO gene<td colspan=2>%s</tr>\n", transAttrs->geneName); printf("<tr><th>CCDS<td>%s<td></tr>\n", transAttrs->ccdsId); // FIXME: add sequence here?? printf("</tbody></table>\n"); } static void writeSequenceHtml(struct trackDb *tdb, char *gencodeId, struct genePred *transAnno) /* write links to get sequences */ { printf("<table class=\"hgcCcds\"><thead>\n"); printf("<tr><th colspan=\"2\">Sequences</tr>\n"); printf("</thead><tbody>\n"); if (transAnno->cdsStart < transAnno->cdsEnd) { // protein coding @@ -287,31 +302,31 @@ { printf("<tr>"); for (i = 0; i < 3; i++) { if (pubMed != NULL) { writePubMedEntry(pubMed); pubMed = pubMed->next; } else printf("<td>"); } printf("</tr>\n"); rowCnt++; } -printf("</thead></table>\n"); +printf("</tbody></table>\n"); } static void writeRefSeqEntry(struct wgEncodeGencodeRefSeq *refSeq) /* write HTML table entry for a RefSeq */ { printf("<td><a href=\""); printEntrezNucleotideUrl(stdout, refSeq->rnaAcc); printf("\" target=_blank>%s</a>", refSeq->rnaAcc); printf("<td>"); if (!isEmpty(refSeq->pepAcc)) { printf("<a href=\""); printEntrezProteinUrl(stdout, refSeq->pepAcc); printf("\" target=_blank>%s</a>", refSeq->pepAcc); }