src/hg/instinct/bioInt2/bioIntDb.c 1.4

1.4 2009/03/27 20:15:52 jsanborn
updated code and added UI stubs
Index: src/hg/instinct/bioInt2/bioIntDb.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/bioInt2/bioIntDb.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -B -U 4 -r1.3 -r1.4
--- src/hg/instinct/bioInt2/bioIntDb.c	22 Mar 2009 01:07:28 -0000	1.3
+++ src/hg/instinct/bioInt2/bioIntDb.c	27 Mar 2009 20:15:52 -0000	1.4
@@ -9,8 +9,31 @@
 #include "bioIntDb.h"
 
 static char const rcsid[] = "$Id$";
 
+void sqlFloatDynamicArrayFixedSize(char *s, float **retArray, int size)
+/* Convert comma separated list of numbers to an dynamically allocated
+ * array, which should be freeMem()'d when done. */
+{
+float *array = NULL;
+unsigned count = 0;
+
+AllocArray(array, size);
+for (;;)
+    {
+    char *e;
+    if (s == NULL || s[0] == 0 || count == size)
+	break;
+    e = strchr(s, ',');
+    if (e != NULL)
+	*e++ = 0;
+
+    array[count++] = atof(s);
+    s = e;
+    }
+*retArray = array;
+}    
+
 void pathwaysStaticLoad(char **row, struct pathways *ret)
 /* Load a row from pathways table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -184,8 +207,36 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void pathwaysJsonOutput(struct pathways *el, FILE *f) 
+/* Print out pathways in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->name);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"source");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->source);
+fputc('"',f);
+fputc('}',f);
+}
+
 void pathwayGenesStaticLoad(char **row, struct pathwayGenes *ret)
 /* Load a row from pathwayGenes table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -342,8 +393,26 @@
 fprintf(f, "%u", el->gene_id);
 fputc(lastSep,f);
 }
 
+void pathwayGenesJsonOutput(struct pathwayGenes *el, FILE *f) 
+/* Print out pathwayGenes in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"gene_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->gene_id);
+fputc('}',f);
+}
+
 void pathwayInfoStaticLoad(char **row, struct pathwayInfo *ret)
 /* Load a row from pathwayInfo table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -507,8 +576,28 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void pathwayInfoJsonOutput(struct pathwayInfo *el, FILE *f) 
+/* Print out pathwayInfo in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"description");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->description);
+fputc('"',f);
+fputc('}',f);
+}
+
 void tissuesStaticLoad(char **row, struct tissues *ret)
 /* Load a row from tissues table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -672,8 +761,28 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void tissuesJsonOutput(struct tissues *el, FILE *f) 
+/* Print out tissues in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->name);
+fputc('"',f);
+fputc('}',f);
+}
+
 void dataTypesStaticLoad(char **row, struct dataTypes *ret)
 /* Load a row from dataTypes table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -847,8 +956,36 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void dataTypesJsonOutput(struct dataTypes *el, FILE *f) 
+/* Print out dataTypes in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"format");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->format);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->name);
+fputc('"',f);
+fputc('}',f);
+}
+
 void datasetsStaticLoad(char **row, struct datasets *ret)
 /* Load a row from datasets table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -1057,8 +1194,70 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void datasetsJsonOutput(struct datasets *el, FILE *f) 
+/* Print out datasets in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"tissue_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->tissue_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"type_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->type_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"num_samples");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->num_samples);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->name);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"data_table");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->data_table);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"probe_table");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->probe_table);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"probe_to_gene_table");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->probe_to_gene_table);
+fputc('"',f);
+fputc('}',f);
+}
+
 void cohortsStaticLoad(char **row, struct cohorts *ret)
 /* Load a row from cohorts table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -1222,8 +1421,28 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void cohortsJsonOutput(struct cohorts *el, FILE *f) 
+/* Print out cohorts in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->name);
+fputc('"',f);
+fputc('}',f);
+}
+
 void datasetCohortStaticLoad(char **row, struct datasetCohort *ret)
 /* Load a row from datasetCohort table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -1380,8 +1599,26 @@
 fprintf(f, "%u", el->cohort_id);
 fputc(lastSep,f);
 }
 
+void datasetCohortJsonOutput(struct datasetCohort *el, FILE *f) 
+/* Print out datasetCohort in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"dataset_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->dataset_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"cohort_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->cohort_id);
+fputc('}',f);
+}
+
 void geneLookupStaticLoad(char **row, struct geneLookup *ret)
 /* Load a row from geneLookup table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -1545,8 +1782,28 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void geneLookupJsonOutput(struct geneLookup *el, FILE *f) 
+/* Print out geneLookup in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"kgId");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->kgId);
+fputc('"',f);
+fputc('}',f);
+}
+
 void probeInfoStaticLoad(char **row, struct probeInfo *ret)
 /* Load a row from probeInfo table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -1730,8 +1987,48 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void probeInfoJsonOutput(struct probeInfo *el, FILE *f) 
+/* Print out probeInfo in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"chrom");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->chrom);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"start");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->start);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"stop");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->stop);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->name);
+fputc('"',f);
+fputc('}',f);
+}
+
 void probeToGeneStaticLoad(char **row, struct probeToGene *ret)
 /* Load a row from probeToGene table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -1888,8 +2185,26 @@
 fprintf(f, "%u", el->gene_id);
 fputc(lastSep,f);
 }
 
+void probeToGeneJsonOutput(struct probeToGene *el, FILE *f) 
+/* Print out probeToGene in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"probe_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->probe_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"gene_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->gene_id);
+fputc('}',f);
+}
+
 void probeSampleValStaticLoad(char **row, struct probeSampleVal *ret)
 /* Load a row from probeSampleVal table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -2051,8 +2366,32 @@
 fprintf(f, "%g", el->val);
 fputc(lastSep,f);
 }
 
+void probeSampleValJsonOutput(struct probeSampleVal *el, FILE *f) 
+/* Print out probeSampleVal in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"probe_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->probe_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"sample_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->sample_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"val");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%g", el->val);
+fputc('}',f);
+}
+
 struct probeVals *probeValsLoad(char **row)
 /* Load a probeVals from row fetched with select * from probeVals
  * from database.  Dispose of this with probeValsFree(). */
 {
@@ -2061,11 +2400,12 @@
 AllocVar(ret);
 ret->sample_count = sqlUnsigned(row[1]);
 ret->probe_id = sqlUnsigned(row[0]);
 {
-int sizeOne;
-sqlFloatDynamicArray(row[2], &ret->sample_data, &sizeOne);
-assert(sizeOne == ret->sample_count);
+sqlFloatDynamicArrayFixedSize(row[2], &ret->sample_data, ret->sample_count);
+//int sizeOne;
+//sqlFloatDynamicArray(row[2], &ret->sample_data, &sizeOne);
+//assert(sizeOne == ret->sample_count);
 }
 return ret;
 }
 
@@ -2234,8 +2574,42 @@
 }
 fputc(lastSep,f);
 }
 
+void probeValsJsonOutput(struct probeVals *el, FILE *f) 
+/* Print out probeVals in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"probe_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->probe_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"sample_count");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->sample_count);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"sample_data");
+fputc('"',f);
+fputc(':',f);
+{
+int i;
+fputc('[',f);
+for (i=0; i<el->sample_count; ++i)
+    {
+    fprintf(f, "%g", el->sample_data[i]);
+    if (i<(el->sample_count)-1)
+    fputc(',',f);
+    }
+fputc(']',f);
+}
+fputc('}',f);
+}
+
 void samplesStaticLoad(char **row, struct samples *ret)
 /* Load a row from samples table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -2429,8 +2803,60 @@
 fprintf(f, "%u", el->tissue_id);
 fputc(lastSep,f);
 }
 
+void samplesJsonOutput(struct samples *el, FILE *f) 
+/* Print out samples in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->name);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"patient_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->patient_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"patient_name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->patient_name);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"dataset_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->dataset_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"exp_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->exp_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"tissue_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->tissue_id);
+fputc('}',f);
+}
+
 void featuresStaticLoad(char **row, struct features *ret)
 /* Load a row from features table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -2614,8 +3040,44 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void featuresJsonOutput(struct features *el, FILE *f) 
+/* Print out features in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->name);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"shortLabel");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->shortLabel);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"longLabel");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->longLabel);
+fputc('"',f);
+fputc('}',f);
+}
+
 void clinicalDataStaticLoad(char **row, struct clinicalData *ret)
 /* Load a row from clinicalData table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -2789,8 +3251,40 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void clinicalDataJsonOutput(struct clinicalData *el, FILE *f) 
+/* Print out clinicalData in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"sample_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->sample_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"feature_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->feature_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"val");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%g", el->val);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"code");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->code);
+fputc('"',f);
+fputc('}',f);
+}
+
 void analysesStaticLoad(char **row, struct analyses *ret)
 /* Load a row from analyses table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -2974,8 +3468,48 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void analysesJsonOutput(struct analyses *el, FILE *f) 
+/* Print out analyses in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"cohort_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->cohort_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"module_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->module_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"result_table");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->result_table);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"input_tables");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->input_tables);
+fputc('"',f);
+fputc('}',f);
+}
+
 void analysisModulesStaticLoad(char **row, struct analysisModules *ret)
 /* Load a row from analysisModules table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -3149,8 +3683,36 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void analysisModulesJsonOutput(struct analysisModules *el, FILE *f) 
+/* Print out analysisModules in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->name);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"type");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->type);
+fputc('"',f);
+fputc('}',f);
+}
+
 void analysisParamsStaticLoad(char **row, struct analysisParams *ret)
 /* Load a row from analysisParams table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -3324,8 +3886,36 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void analysisParamsJsonOutput(struct analysisParams *el, FILE *f) 
+/* Print out analysisParams in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"analysis_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->analysis_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->name);
+fputc('"',f);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"val");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->val);
+fputc('"',f);
+fputc('}',f);
+}
+
 void analysisFeaturesStaticLoad(char **row, struct analysisFeatures *ret)
 /* Load a row from analysisFeatures table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -3489,8 +4079,28 @@
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
+void analysisFeaturesJsonOutput(struct analysisFeatures *el, FILE *f) 
+/* Print out analysisFeatures in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"feature_name");
+fputc('"',f);
+fputc(':',f);
+fputc('"',f);
+fprintf(f, "%s", el->feature_name);
+fputc('"',f);
+fputc('}',f);
+}
+
 void analysisValsStaticLoad(char **row, struct analysisVals *ret)
 /* Load a row from analysisVals table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
@@ -3657,6 +4267,36 @@
 fprintf(f, "%g", el->conf);
 fputc(lastSep,f);
 }
 
+void analysisValsJsonOutput(struct analysisVals *el, FILE *f) 
+/* Print out analysisVals in JSON format. */
+{
+fputc('{',f);
+fputc('"',f);
+fprintf(f,"sample_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->sample_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"feature_id");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%u", el->feature_id);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"val");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%g", el->val);
+fputc(',',f);
+fputc('"',f);
+fprintf(f,"conf");
+fputc('"',f);
+fputc(':',f);
+fprintf(f, "%g", el->conf);
+fputc('}',f);
+}
+
 /* -------------------------------- End autoSql Generated Code -------------------------------- */