1882a226292f155a88d6980e252225d5f25c57f9 markd Sun Feb 16 10:51:30 2014 -0800 Imported Mouse GENCODE M2. diff --git src/hg/hgc/gencodeClick.c src/hg/hgc/gencodeClick.c index 5ca84c2..e7be9b6 100644 --- src/hg/hgc/gencodeClick.c +++ src/hg/hgc/gencodeClick.c @@ -24,34 +24,35 @@ /* * General notes: * - this will be integrated into hgGene at some point, however this was * done as part of hgc for timing reasons and to allow more time to design * the hgGene part. * - Tables below will output at least one row even if no data is available. * */ /* Various URLs and URL templates. At one time, these were in the ra file, * but that didn't prove that helpful and end up requiring updated the ra * files for every GENCODE version if a URL was added or changed. */ //FIXME: clean up RA files when CGIs no longer need them static char *gencodeBiotypesUrl = "http://www.gencodegenes.org/gencode_biotypes.html"; static char *gencodeTagsUrl = "http://www.gencodegenes.org/gencode_tags.html"; -static char *ensemblTranscriptIdUrl = "http://www.ensembl.org/Homo_sapiens/Transcript/Summary?db=core;t=%s"; -static char *ensemblGeneIdUrl = "http://www.ensembl.org/Homo_sapiens/Gene/Summary?db=core;t=%s"; -static char *vegaTranscriptIdUrl = "http://vega.sanger.ac.uk/Homo_sapiens/Transcript/Summary?db=core;t=%s"; -static char *vegaGeneIdUrl = "http://vega.sanger.ac.uk/Homo_sapiens/Gene/Summary?db=core;g=%s"; +static char *ensemblTranscriptIdUrl = "http://www.ensembl.org/%s/Transcript/Summary?db=core;t=%s"; +static char *ensemblGeneIdUrl = "http://www.ensembl.org/%s/Gene/Summary?db=core;t=%s"; +static char *ensemblSupportingEvidUrl = "http://www.ensembl.org/%s/Transcript/SupportingEvidence?db=core;t=%s"; +static char *vegaTranscriptIdUrl = "http://vega.sanger.ac.uk/%s/Transcript/Summary?db=core;t=%s"; +static char *vegaGeneIdUrl = "http://vega.sanger.ac.uk/%s/Gene/Summary?db=core;g=%s"; static char *yalePseudoUrl = "http://tables.pseudogene.org/%s"; static char *hgncUrl = "http://www.genenames.org/data/hgnc_data.php?match=%s"; static char *geneCardsUrl = "http://www.genecards.org/cgi-bin/carddisp.pl?gene=%s"; static char *apprisHomeUrl = "http://appris.bioinfo.cnio.es/"; static char *apprisGeneUrl = "http://appris.bioinfo.cnio.es/report.html?id=%s&namespace=Ensembl_Gene_Id&specie=%s"; static char *apprisTranscriptUrl = "http://appris.bioinfo.cnio.es/report.html?id=%s&namespace=Ensembl_Transcript_Id&specie=%s"; static char *getBaseAcc(char *acc, char *accBuf, int accBufSize) /* get the accession with version number dropped. */ { safecpy(accBuf, accBufSize, acc); char *dot = strchr(accBuf, '.'); if (dot != NULL) *dot = '\0'; return accBuf; @@ -167,53 +168,87 @@ } static char *getSupportLevelDesc(struct wgEncodeGencodeTranscriptionSupportLevel *tsl) /* return description for level */ { static char buf[32]; if ((tsl == NULL) || (tsl->level <= 0)) return "tslNA"; else { safef(buf, sizeof(buf), "tsl%d", tsl->level); return buf; } } +static char* getScientificNameSym(void) +/* get the scientific name of an organism in the form "Homo_sapiens" + * WARNING: static return */ +{ +static char sciNameSym[128]; +char *sciName = hScientificName(database); +if (sciName == NULL) + errAbort("can't get scientific name for %s", database); +safecpy(sciNameSym, sizeof(sciNameSym), sciName); +freeMem(sciName); +subChar(sciNameSym, ' ', '_'); +return sciNameSym; +} + static void prExtIdAnchor(char *id, char *urlTemplate) /* if an id to an external database is not empty, print an HTML anchor to it */ { if (!isEmpty(id)) { char urlBuf[512]; safef(urlBuf, sizeof(urlBuf), urlTemplate, id); printf("%s", urlBuf, id); } } +#if UNUSED static void prTdExtIdAnchor(char *id, char *urlTemplate) /* print a table data element with an anchor for a id */ { printf(""); prExtIdAnchor(id, urlTemplate); } +#endif + +static void prEnsIdAnchor(char *id, char *urlTemplate) +/* if an id to an ensembl or vega database is not empty, print an HTML anchor to it */ +{ +if (!isEmpty(id)) + { + char urlBuf[512]; + safef(urlBuf, sizeof(urlBuf), urlTemplate, getScientificNameSym(), id); + printf("%s", urlBuf, id); + } +} -static void prApprisTdAnchor(char *id, struct sqlConnection *conn, char *urlTemplate) +static void prTdEnsIdAnchor(char *id, char *urlTemplate) +/* print a table data element with an ensembl/vega anchor for a id */ +{ +printf(""); +prEnsIdAnchor(id, urlTemplate); +} + +static void prApprisTdAnchor(char *id, char *urlTemplate) /* print a gene or transcript link to APPRIS */ { // under bar separated, lower case species name. -char *speciesArg = hScientificName(sqlGetDatabase(conn)); +char *speciesArg = hScientificName(database); toLowerN(speciesArg, strlen(speciesArg)); subChar(speciesArg, ' ', '_'); char accBuf[64]; printf("%s", id); freeMem(speciesArg); } static void writePosLink(char *chrom, int chromStart, int chromEnd) /* write link to a genomic position */ { printf("%s:%d-%d", @@ -227,37 +262,37 @@ bool haveTsl, struct wgEncodeGencodeTranscriptionSupportLevel *tsl) /* write basic HTML info for all genes */ { /* * notes: * - According to Steve: `status' is not the same for ensembl and havana. So either avoid displaying it * or display it as `automatic status' or `manual status'. */ // basic gene and transcript information printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n", transAnno->strand); printf("\n", gencodeBiotypesUrl, transAttrs->transcriptType, transAttrs->geneType); printf("\n", transAttrs->transcriptStatus, transAttrs->geneStatus); @@ -278,32 +313,32 @@ if (!isEmpty(transAttrs->ccdsId)) { printf("ccdsId); printf("\" target=_blank>%s", transAttrs->ccdsId); } printf("\n"); printf("\n"); if (isProteinCodingTrans(transAttrs)) { printf("\n"); } // FIXME: add sequence here?? printf("
TranscriptGene
Gencode id"); -prTdExtIdAnchor(transAttrs->transcriptId, ensemblTranscriptIdUrl); -prTdExtIdAnchor(transAttrs->geneId, ensemblGeneIdUrl); +prTdEnsIdAnchor(transAttrs->transcriptId, ensemblTranscriptIdUrl); +prTdEnsIdAnchor(transAttrs->geneId, ensemblGeneIdUrl); printf("
HAVANA manual id"); -prTdExtIdAnchor(transAttrs->havanaTranscriptId, vegaTranscriptIdUrl); -prTdExtIdAnchor(transAttrs->havanaGeneId, vegaGeneIdUrl); +prTdEnsIdAnchor(transAttrs->havanaTranscriptId, vegaTranscriptIdUrl); +prTdEnsIdAnchor(transAttrs->havanaGeneId, vegaGeneIdUrl); printf("
Position"); printf(""); writePosLink(transAnno->chrom, transAnno->txStart, transAnno->txEnd); printf(""); writePosLink(transAnno->chrom, geneChromStart, geneChromEnd); printf("
Strand%s
Biotype%s%s
Status%s%s
GeneCards"); prExtIdAnchor(transAttrs->geneName, geneCardsUrl); printf("
APPRIS\n", apprisHomeUrl); - prApprisTdAnchor(transAttrs->transcriptId, conn, apprisTranscriptUrl); - prApprisTdAnchor(transAttrs->geneId, conn, apprisGeneUrl); + prApprisTdAnchor(transAttrs->transcriptId, apprisTranscriptUrl); + prApprisTdAnchor(transAttrs->geneId, apprisGeneUrl); printf("
\n"); } static void writeSequenceHtml(struct trackDb *tdb, char *gencodeId, struct genePred *transAnno) /* write links to get sequences */ { printf("\n"); printf("\n"); printf("\n"); if (transAnno->cdsStart < transAnno->cdsEnd) { @@ -548,75 +583,60 @@ slReverse(&supportEvids2); *supportEvids = supportEvids2; } static struct supportEvid *loadSupportEvid(struct wgEncodeGencodeTranscriptSupport *transcriptSupports, struct wgEncodeGencodeExonSupport *exonSupports) /* load transcript and supporting evidence into a common structure */ { struct supportEvid *supportEvids = NULL; transcriptSupportToSupportEvid(&supportEvids, transcriptSupports); exonSupportToSupportEvid(&supportEvids, exonSupports); sortUniqSupportExidence(&supportEvids); return supportEvids; } -static char *getSupportEvidEnsemblUrl(char *gencodeId) -/* Generate a URL to the ensembl supporting evidence page. - * WARNING: static return. */ -{ -static char url[256]; -// generate organism part of url in the form: Homo_sapiens -char *sciName = hScientificName(database); -if (sciName == NULL) - errAbort("can't get scientific name for %s", database); -char *space = strchr(sciName, ' '); -if (space != NULL) - *space = '_'; -safef(url, sizeof(url), "http://www.ensembl.org/%s/Transcript/SupportingEvidence?db=core;t=%s", sciName, gencodeId); -freeMem(sciName); -return url; -} - -static void writeSupportExidenceEntry(struct supportEvid *supportEvid) +static void writeSupportEvidenceEntry(struct supportEvid *supportEvid) /* write HTML table entry for a supporting evidence */ { // FIXME: should link to sources when possible printf("
Sequences
%s", supportEvid->seqSrc); printf("%s", supportEvid->seqId); } static void writeSupportingEvidenceLinkHtml(char *gencodeId, struct wgEncodeGencodeTranscriptSupport *transcriptSupports, struct wgEncodeGencodeExonSupport *exonSupports) /* write HTML links to supporting evidence */ { struct supportEvid *supportEvids = loadSupportEvid(transcriptSupports, exonSupports); printf("\n"); -printf("\n", getSupportEvidEnsemblUrl(gencodeId)); +printf("\n"); printf("\n"); printf("\n"); struct supportEvid *supportEvid = supportEvids; int i, rowCnt = 0; while ((supportEvid != NULL) || (rowCnt == 0)) { printf(""); for (i = 0; i < 2; i++) { if (supportEvid != NULL) { - writeSupportExidenceEntry(supportEvid); + writeSupportEvidenceEntry(supportEvid); supportEvid = supportEvid->next; } else printf("\n"); rowCnt++; } printf("
Supporting Evidence (view in Ensembl)
Supporting Evidence ("); +prEnsIdAnchor(gencodeId, ensemblSupportingEvidUrl); +printf(")
SourceSequenceSourceSequence
"); } printf("
\n"); slFreeList(&supportEvids); } static void writeTagEntry(struct wgEncodeGencodeTag *tag) /* write HTML table entry for a Tag */ {