293923a610a014d169a8b4c83a3d91719aab942c
kate
Wed Aug 24 14:54:08 2016 -0700
Comment out broken link to GTEx portal. Broad has been alerted.
diff --git src/hg/hgc/gtexClick.c src/hg/hgc/gtexClick.c
index dab7f9a..63f7f5d 100644
--- src/hg/hgc/gtexClick.c
+++ src/hg/hgc/gtexClick.c
@@ -1,141 +1,142 @@
/* Details pages for GTEx tracks */
/* Copyright (C) 2015 The Regents of the University of California
* See README in this or parent directory for licensing information. */
#include "common.h"
#include "hash.h"
#include "hdb.h"
#include "hvGfx.h"
#include "trashDir.h"
#include "hgc.h"
#include "hCommon.h"
#include "gtexGeneBed.h"
#include "gtexTissue.h"
#include "gtexUi.h"
#include "gtexInfo.h"
char *geneClassColorCode(char *geneClass)
/* Get HTML color code used by GENCODE for transcript class
* WARNING: should share code with gene color handling in hgTracks */
{
char *unknown = "#010101";
if (geneClass == NULL)
return unknown;
if (sameString(geneClass, "coding"))
return "#0C0C78";
if (sameString(geneClass, "nonCoding"))
return "#006400";
if (sameString(geneClass, "pseudo"))
return "#FF33FF";
if (sameString(geneClass, "problem"))
return "#FE0000";
return unknown;
}
static struct gtexGeneBed *getGtexGene(char *item, char *chrom, int start, int end, char *table)
/* Retrieve gene info for this item from the main track table */
{
struct gtexGeneBed *gtexGene = NULL;
struct sqlConnection *conn = hAllocConn(database);
char **row;
char query[512];
struct sqlResult *sr;
if (sqlTableExists(conn, table))
{
sqlSafef(query, sizeof query, "SELECT * FROM %s WHERE name = '%s' AND chrom = '%s' "
" and chromStart = %d and chromEnd = %d",
table, item, chrom, start, end);
sr = sqlGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
{
gtexGene = gtexGeneBedLoad(row);
}
sqlFreeResult(&sr);
}
hFreeConn(&conn);
return gtexGene;
}
char *getGeneDescription(struct gtexGeneBed *gtexGene)
/* Get description for gene. Needed because knownGene table semantics have changed in hg38 */
{
char query[256];
if (sameString(database, "hg38"))
{
char *geneId = cloneString(gtexGene->geneId);
chopSuffix(geneId);
sqlSafef(query, sizeof(query),
"SELECT kgXref.description FROM kgXref, knownCanonical WHERE "
"knownCanonical.protein LIKE '%%%s%%' AND "
"knownCanonical.transcript=kgXref.kgID", geneId);
}
else
{
sqlSafef(query, sizeof(query),
"SELECT kgXref.description FROM kgXref WHERE geneSymbol='%s'",
gtexGene->name);
}
struct sqlConnection *conn = hAllocConn(database);
char *desc = sqlQuickString(conn, query);
hFreeConn(&conn);
return desc;
}
void doGtexGeneExpr(struct trackDb *tdb, char *item)
/* Details of GTEx gene expression item */
{
int start = cartInt(cart, "o");
int end = cartInt(cart, "t");
struct gtexGeneBed *gtexGene = getGtexGene(item, seqName, start, end, tdb->table);
if (gtexGene == NULL)
errAbort("Can't find gene %s in GTEx gene table %s\n", item, tdb->table);
char *version = gtexVersion(tdb->table);
genericHeader(tdb, item);
printf("Gene: ");
char *desc = getGeneDescription(gtexGene);
if (desc == NULL)
printf("%s
\n", gtexGene->name);
else
{
printf("%s
\n",
hgGeneName(), database, gtexGene->name, gtexGene->name);
printf("Description: %s
\n", desc);
}
printf("Ensembl gene ID: %s
\n", gtexGene->geneId);
// The actual transcript model is a union, so this identification is approximate
// (used just to find a transcript class)
char *geneClass = gtexGeneClass(gtexGene);
printf("GENCODE biotype: %s
\n", gtexGene->geneType);
printf("Gene class: %s
\n",
geneClassColorCode(geneClass), geneClass);
int tisId;
float highLevel = gtexGeneHighestMedianExpression(gtexGene, &tisId);
printf("Highest median expression: %0.2f RPKM in %s
\n",
highLevel, gtexGetTissueDescription(tisId, version));
printf("Total median expression: %0.2f RPKM
\n", gtexGeneTotalMedianExpression(gtexGene));
printf("Score: %d
\n", gtexGene->score);
printf("Genomic position: "
"%s %s:%d-%d
\n",
database, hgTracksPathAndSettings(), database,
gtexGene->chrom, gtexGene->chromStart+1, gtexGene->chromEnd,
gtexGene->chrom, gtexGene->chromStart+1, gtexGene->chromEnd);
puts("
");
// set gtexDetails (e.g. to 'log') to show log transformed details page
// if hgTracks is log-transformed
boolean doLogTransform =
(trackDbSetting(tdb, "gtexDetails") &&
cartUsualBooleanClosestToHome(cart, tdb, FALSE, GTEX_LOG_TRANSFORM,
GTEX_LOG_TRANSFORM_DEFAULT));
struct tempName pngTn;
if (gtexGeneBoxplot(gtexGene->geneId, gtexGene->name, version, doLogTransform, &pngTn))
printf("
\n", pngTn.forHtml);
printf("
");
-gtexPortalLink(gtexGene->geneId);
+//gtexPortalLink(gtexGene->geneId);
+// Link broken as of 8/23/16. Broad has been alerted.
printTrackHtml(tdb);
}