707bd9f05c4c104fb6a90a680aa72d38895b67a3 kate Mon Jun 26 18:32:29 2017 -0700 Details page. refs #15646 diff --git src/hg/hgc/gtexEqtlClusterClick.c src/hg/hgc/gtexEqtlClusterClick.c new file mode 100644 index 0000000..a63d938 --- /dev/null +++ src/hg/hgc/gtexEqtlClusterClick.c @@ -0,0 +1,72 @@ +/* Details page for GTEx eQTL Clusters */ + +/* Copyright (C) 2017 The Regents of the University of California + * See README in this or parent directory for licensing information. */ + +#include "common.h" +#include "web.h" +#include "gtexTissue.h" +#include "gtexInfo.h" +#include "gtexEqtlCluster.h" +#include "hgc.h" + +static struct gtexEqtlCluster *getGtexEqtl(char *item, char *chrom, int start, char *table) +/* Retrieve this item from the track table */ +{ +char *gene = firstWordInLine(cloneString(item)); +struct sqlConnection *conn = hAllocConn(database); +char query[512]; +sqlSafef(query, sizeof(query), "SELECT * FROM %s WHERE chrom='%s' AND chromStart=%d AND target='%s'", + table, chrom, start, gene); +struct gtexEqtlCluster *eqtl = gtexEqtlClusterLoadByQuery(conn, query); +hFreeConn(&conn); +return eqtl; +} + +void doGtexEqtlDetails(struct trackDb *tdb, char *item) +/* Details of GTEx eQTL item */ +{ +char *chrom = cartString(cart, "c"); +int start = cartInt(cart, "o"); +struct gtexEqtlCluster *eqtl = getGtexEqtl(item, chrom, start, tdb->table); +genericHeader(tdb, item); +char *version = gtexVersion(tdb->table); +struct gtexTissue *tissues = gtexGetTissues(version); +struct hash *tissueHash = hashNew(0); +struct gtexTissue *tis = NULL; +for (tis = tissues; tis != NULL; tis = tis->next) + hashAdd(tissueHash, tis->name, tis); +int i; +printf("Gene: %s   \n", eqtl->target); +char posLink[1024]; +safef(posLink, sizeof(posLink),"%s:%d-%d", + hgTracksPathAndSettings(), database, + eqtl->chrom, eqtl->chromStart+1, eqtl->chromEnd, + eqtl->chrom, eqtl->chromStart+1, eqtl->chromEnd); +printf("
Variant: %s\n", eqtl->name); +printf("
Position: %s\n", posLink); +printf("
Number of tissues with this eQTL: %d\n", eqtl->expCount); +printf("
Score: %d\n", eqtl->score); +webNewSection("eQTL effect size and causal probability by tissue"); +printf("\n"); +//printf(""); +printf(""); +printf("\n"); +for (i=0; iexpCount; i++) + { + double effect= eqtl->expScores[i]; + double prob = eqtl->expProbs[i]; + struct gtexTissue *tis = (struct gtexTissue *)hashFindVal(tissueHash, eqtl->expNames[i]); + unsigned color = tis ? tis->color : 0; // BLACK + char *name = tis ? tis->description : "Unknown"; + printf("\n", + color, name, effect < 0 ? "" : "+", effect, prob); + } +printf("
   TissueEffect   Probability
%s%s%0.2f%0.2f
"); +webEndSection(); +webNewEmptySection(); +printTrackHtml(tdb); +} + + +