e3e21c453e6963fddd0f1c32a1d6a4b9bab685e2 hiram Thu Feb 4 14:57:18 2016 -0800 first pass as display of metadata for NCBI RefSeq track, needs improvement refs #13673 diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index bb36852..e6e685b 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -87,30 +87,31 @@ #include "cnpIafrate2.h" #include "cnpLocke.h" #include "cnpSebat.h" #include "cnpSebat2.h" #include "cnpSharp.h" #include "cnpSharp2.h" #include "delHinds2.h" #include "delConrad2.h" #include "dgv.h" #include "dgvPlus.h" #include "tokenizer.h" #include "softberryHom.h" #include "borkPseudoHom.h" #include "sanger22extra.h" #include "ncbiRefLink.h" +#include "ncbiRefSeqLink.h" #include "refLink.h" #include "hgConfig.h" #include "estPair.h" #include "softPromoter.h" #include "customTrack.h" #include "trackHub.h" #include "hubConnect.h" #include "sage.h" #include "sageExp.h" #include "pslWScore.h" #include "lfs.h" #include "mcnBreakpoints.h" #include "fishClones.h" #include "featureBits.h" #include "web.h" @@ -11397,30 +11398,94 @@ /* optional summary text */ summary = getRefSeqSummary(conn, sqlRnaName); if (summary != NULL) { htmlHorizontalLine(); printf("

Summary of %s

\n", rl->name); printf("

%s

\n", summary); freeMem(summary); } htmlHorizontalLine(); return rl; } +void doNcbiRefSeq(struct trackDb *tdb, char *rnaName) +/* Process click on a NCBI RefSeq gene. */ +{ +struct sqlConnection *conn = hAllocConn(database); +struct sqlResult *sr; +char **row; +char query[256]; +char *sqlRnaName = rnaName; +struct ncbiRefSeqLink *nrl; +char noDot[1024]; + +struct dyString *dy = newDyString(1024); +dyStringPrintf(dy, "%s", tdb->longLabel); + +struct trackVersion *trackVersion = getTrackVersion(database, "ncbiRefSeq"); +if ((trackVersion != NULL) && !isEmpty(trackVersion->version)) + dyStringPrintf(dy, "- Release %s\n", trackVersion->version); + +cartWebStart(cart, database, "%s", dy->string); +safecpy(noDot, sizeof noDot, rnaName); +char *ptr = strchr(noDot, '.'); +if (ptr) + *ptr++ = 0; + +/* get refLink entry */ +sqlSafef(query, sizeof(query), "select * from ncbiRefSeqLink where id = '%s'", sqlRnaName); +sr = sqlGetResult(conn, query); +if ((row = sqlNextRow(sr)) == NULL) + errAbort("Couldn't find %s in ncbiRefSeqLink table.", rnaName); +nrl = ncbiRefSeqLinkLoad(row); +sqlFreeResult(&sr); + +/* print the first section with info */ +printf("