src/hg/instinct/hgGeneset/hgGenesets.c 1.15

1.15 2010/02/11 23:12:09 jsanborn
update getmatching
Index: src/hg/instinct/hgGeneset/hgGenesets.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/hgGeneset/hgGenesets.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -b -B -U 4 -r1.14 -r1.15
--- src/hg/instinct/hgGeneset/hgGenesets.c	1 Feb 2010 14:58:41 -0000	1.14
+++ src/hg/instinct/hgGeneset/hgGenesets.c	11 Feb 2010 23:12:09 -0000	1.15
@@ -1087,15 +1087,17 @@
 }
 
 void drawHeatmap()
 {
+int dataset_id   = cartUsualInt(cart, hghDatasetId, -1);
+if (dataset_id == -1)
+    errAbort("Cart empty");
 struct sqlConnection *conn = hAllocConnProfile(localDb, db);
 
 int width  = cartUsualInt(cart, hghWidth, DEFAULT_HEATMAP_WIDTH);
 int height = cartUsualInt(cart, hghHeight, DEFAULT_HEATMAP_HEIGHT);
 char *sampleIds  = cartOptionalString(cart, hghSampleIds);
 char *featureIds = cartOptionalString(cart, hghFeatureIds);
-int dataset_id   = cartUsualInt(cart, hghDatasetId, -1);
 
 int getFirst = cartUsualInt(cart, hghGetFirst, -1);
 
 /* Clustering */
@@ -1229,14 +1231,19 @@
 }
 
 void sendAmbiguities(struct json *js, struct searchResults *spList)
 {
+struct json *match, *matches = jsonAddContainerList(js, "results");
+match = matches;
 struct searchResults *sp;
 for (sp = spList; sp; sp = sp->next)
     {
-    struct json *new = jsonAddContainer(js, sp->name);
-    jsonAddInt(new, "id", sp->id);
-    jsonAddString(new, "type", sp->type);
+    jsonAddString(match, "name", sp->name);
+    jsonAddInt(match, "id", sp->id);
+    jsonAddString(match, "type", sp->type);
+
+    if (sp->next)
+	match = jsonAddContainerToList(&matches);
     }
 }
 
 void getMatching()