src/hg/instinct/bioInt2/bioIntUI.c 1.22

1.22 2009/05/27 22:48:02 jsanborn
fixed bug
Index: src/hg/instinct/bioInt2/bioIntUI.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/bioInt2/bioIntUI.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -b -B -U 4 -r1.21 -r1.22
--- src/hg/instinct/bioInt2/bioIntUI.c	27 May 2009 21:48:35 -0000	1.21
+++ src/hg/instinct/bioInt2/bioIntUI.c	27 May 2009 22:48:02 -0000	1.22
@@ -426,8 +426,10 @@
 void sendRawFeatureData(struct sqlConnection *conn, struct json *js, 
 			struct datasets *da, struct samples *saList, 
 			struct analysisFeatures *af)
 {
+char *dataType = getDataTypeById(conn, da->type_id);
+
 struct samples *sa;
 struct dyString *dy = dyStringNew(100);
 
 dyStringPrintf(dy, 
@@ -448,12 +450,14 @@
 
 if (!sqlExists(conn, query))
     return;
 
-setAnalysisFeatureDesc(conn, js, af);
-setAnalysisFeatureLink(conn, js, af);  // e.g. 'hgg_gene' = kgId
+struct json *container = jsonAddContainer(js, dataType);
     
-struct json *data = jsonAddContainer(js, "data");
+setAnalysisFeatureDesc(conn, container, af);
+setAnalysisFeatureLink(conn, container, af);  // e.g. 'hgg_gene' = kgId
+    
+struct json *data = jsonAddContainer(container, "data");
 struct sqlResult *sr = sqlGetResult(conn, query);
 char **row = NULL;
 while ((row = sqlNextRow(sr)) != NULL)
     { 
@@ -477,13 +481,9 @@
 struct samples *samples = getOverlappingSamples(conn, daList);
 
 struct json *js = newJson();
 for (da = daList; da; da = da->next)
-    {
-    char *dataType = getDataTypeById(conn, da->type_id);
-    struct json *container = jsonAddContainer(js, dataType);
-    sendRawFeatureData(conn, container, da, samples, af);
-    }
+    sendRawFeatureData(conn, js, da, samples, af);
 
 if (js)
     hPrintf("%s", js->print(js));
 }