7055494b015f7d0f4ef355d7c6fb31a67cfb38bf
kate
Sun Oct 4 15:09:47 2015 -0700
Move GTEx track details into separate file. refs #13504
diff --git src/hg/hgc/gtexClick.c src/hg/hgc/gtexClick.c
new file mode 100644
index 0000000..2d02174
--- /dev/null
+++ src/hg/hgc/gtexClick.c
@@ -0,0 +1,88 @@
+/* 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 "hdb.h"
+#include "hgc.h"
+
+#include "rainbow.h"
+#include "gtexUi.h"
+#include "gtexGeneBed.h"
+#include "gtexTissue.h"
+
+
+void doGtexGeneExpr(struct trackDb *tdb, char *item)
+/* Details of GTEX gene expression item */
+{
+// Load item from table */
+
+// TODO: Get full details from Data table
+struct dyString *dy = dyStringNew(0);
+//char sampleTable[128];
+//safef(sampleTable, sizeof(able), "%sSampleData", tdb->table);
+
+struct sqlConnection *conn = hAllocConn(database);
+char **row;
+struct gtexGeneBed *gtexGene = NULL;
+int expCount = 0;
+if (sqlTableExists(conn, tdb->table))
+ {
+ char query[512];
+ sqlSafef(query, sizeof(query), "select * from %s where name = '%s'", tdb->table, item);
+ struct sqlResult *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);
+ }
+printTrackHtml(tdb);
+
+// Print out tissue table with color assignments
+conn = hAllocConn("hgFixed");
+char *tissueTable = "gtexTissue";
+if (sqlTableExists(conn, tissueTable))
+ {
+ dyStringPrintf(dy, "
Color | Tissue | %s | \n", + color.r, color.g, color.b, tissue->description); + } + sqlFreeResult(&sr); + } +hFreeConn(&conn); +dyStringPrintf(dy, "