1831801fae90a4dbda52bfc056ba230b0ffb07f3
kate
Thu Oct 8 15:52:03 2015 -0700
A stab at adding axes and title to graph for GTEx details page. refs #15645
diff --git src/hg/hgc/gtexClick.c src/hg/hgc/gtexClick.c
index 1f0d8ec..643c710 100644
--- src/hg/hgc/gtexClick.c
+++ src/hg/hgc/gtexClick.c
@@ -11,43 +11,51 @@
#include "rainbow.h"
#include "hvGfx.h"
#include "gtexUi.h"
#include "gtexGeneBed.h"
#include "gtexTissue.h"
#include "gtexSampleData.h"
/* Dimensions of image parts */
int pad = 2;
int margin = 1;
//int graphHeight = 400;
int graphHeight = 325;
//int barWidth = 3;
int barWidth = 12;
+int titleHeight = 30;
+
+int xAxisHeight = 100;
+int yAxisWidth = 50;
+int axisMargin = 5;
/* Dimensions of image overall and our portion within it. */
int imageWidth, imageHeight, innerWidth, innerHeight, innerXoff, innerYoff;
+int plotWidth, plotHeight; /* just the plot */
void setImageDims(int expCount)
/* Set up image according to count */
{
innerHeight = graphHeight + 2*pad;
innerWidth = pad + expCount*(pad + barWidth);
-imageWidth = innerWidth + 2*margin;
-imageHeight = innerHeight + 2*margin;
-innerXoff = margin;
-innerYoff = margin;
+plotWidth = innerWidth + 2*margin;
+plotHeight = innerHeight + 2*margin;
+imageWidth = plotWidth + yAxisWidth;
+imageHeight = plotHeight + xAxisHeight + titleHeight;
+innerXoff = yAxisWidth + margin;
+innerYoff = titleHeight + margin;
}
struct rgbColor rgbFromIntColor(int color)
{
return (struct rgbColor){.r=COLOR_32_BLUE(color), .g=COLOR_32_GREEN(color), .b=COLOR_32_RED(color)};
}
struct tissueSampleVals
/* RPKM expression values for multiple samples */
{
struct tissueSampleVals *next;
char *description; /* GTEx tissue description */
int color; /* GTEx tissue color */
int count; /* number of samples */
double *vals; /* RPKM values */
@@ -177,33 +185,35 @@
sr = sqlGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
{
gtexGene = gtexGeneBedLoad(row);
expCount = gtexGene->expCount;
}
sqlFreeResult(&sr);
}
hFreeConn(&conn);
genericHeader(tdb, item);
if (gtexGene != NULL)
{
- printf("Gene name: %s
\n", gtexGene->name);
- printf("Ensembl gene: %s
\n", gtexGene->geneId);
- printf("Ensembl transcript: %s
\n", gtexGene->transcriptId);
+ // TODO: link to UCSC gene
+ printf("Gene: %s", gtexGene->name);
+ printf("Ensembl ID: %s
\n", gtexGene->geneId);
+ printf("View at GTEx portal
\n", gtexGene->geneId);
+ puts("
");
}
// Get full sample data for this gene
char *sampleDataTable = "gtexSampleData";
conn = hAllocConn("hgFixed");
assert(sqlTableExists(conn, sampleDataTable));
sqlSafef(query, sizeof(query), "select * from %s where geneId='%s'",
sampleDataTable, gtexGene->geneId);
sr = sqlGetResult(conn, query);
struct hash *tsHash = hashNew(0);
struct tissueSampleVals *tsv;
struct hashEl *hel;
struct slDouble *val;
double maxVal = 0;
struct gtexSampleData *sd = NULL;
@@ -240,53 +250,67 @@
double *vals = AllocArray(tsv->vals, count);
for (i=0; i
\n", pngTn.forHtml);
/*printf("
\n",
pngTn.forHtml, imageWidth, imageHeight);
*/
//cloneString(gifTn.forHtml);
// Track description
printTrackHtml(tdb);
// Print out tissue table with color assignments
#ifdef DEBUG
conn = hAllocConn("hgFixed");
char *tissueTable = "gtexTissue";
if (sqlTableExists(conn, tissueTable))