src/hg/instinct/hgHeatmap2/hgToolTip.c 1.9

1.9 2009/08/21 22:22:35 jzhu
add patient id to tooltip
Index: src/hg/instinct/hgHeatmap2/hgToolTip.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/hgHeatmap2/hgToolTip.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -b -B -U 4 -r1.8 -r1.9
--- src/hg/instinct/hgHeatmap2/hgToolTip.c	4 Jun 2009 03:50:37 -0000	1.8
+++ src/hg/instinct/hgHeatmap2/hgToolTip.c	21 Aug 2009 22:22:35 -0000	1.9
@@ -154,9 +154,9 @@
 char *patField = gh->patField;
 char *patTable = gh->patTable;
 char *sampleField = gh->sampleField;
 
-if (!raName || !db || !patField || !patTable || !sampleField)
+if (!db || !patField || !patTable || !sampleField)
     return NULL;
 struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, db);
 
 char query[256];
@@ -186,8 +186,33 @@
 hFreeConn(&conn);
 return val;
 }
 
+char *toolTipByPatient(struct genoHeatmap *gh, char *sampleId)
+{
+/* set up connection to table with both patient and sample information */
+char *db = gh->patDb;
+//char *raName = gh->raFile;
+char *patField = gh->patField;
+char *patTable = gh->patTable;
+char *sampleField = gh->sampleField;
+
+//if (!raName || !db || !patField || !patTable || !sampleField)
+if (!db || !patField || !patTable || !sampleField)
+    return NULL;
+struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, db);
+
+char query[256];
+safef(query, sizeof(query), 
+      "select %s from %s where %s = \"%s\"",
+      patField, patTable, sampleField, sampleId);
+
+char *trackId = sqlQuickString(conn, query);
+hFreeConn(&conn);
+
+return trackId;
+}
+
 char *toolTipGeneTrackByChromPos(char *db, char *tableName, char *chromName,
 				 int chromStart, int chromStop, int maxNumGenes)
 {
 char **row = NULL;