src/hg/instinct/bioInt2/bioIntDb.h 1.5

1.5 2009/03/29 01:40:42 jsanborn
added to UI code
Index: src/hg/instinct/bioInt2/bioIntDb.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/bioInt2/bioIntDb.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -b -B -U 4 -r1.4 -r1.5
--- src/hg/instinct/bioInt2/bioIntDb.h	27 Mar 2009 20:15:52 -0000	1.4
+++ src/hg/instinct/bioInt2/bioIntDb.h	29 Mar 2009 01:40:42 -0000	1.5
@@ -82,11 +82,8 @@
 
 #define pathwaysCommaOut(el,f) pathwaysOutput(el,f,',',',');
 /* Print out pathways as a comma separated list including final comma. */
 
-void pathwaysJsonOutput(struct pathways *el, FILE *f);
-/* Print out pathways in JSON format. */
-
 #define PATHWAYGENES_NUM_COLS 2
 
 struct pathwayGenes
 /* Pathway Genes */
@@ -161,11 +158,8 @@
 
 #define pathwayGenesCommaOut(el,f) pathwayGenesOutput(el,f,',',',');
 /* Print out pathwayGenes as a comma separated list including final comma. */
 
-void pathwayGenesJsonOutput(struct pathwayGenes *el, FILE *f);
-/* Print out pathwayGenes in JSON format. */
-
 #define PATHWAYINFO_NUM_COLS 2
 
 struct pathwayInfo
 /* Pathway Information */
@@ -240,11 +234,8 @@
 
 #define pathwayInfoCommaOut(el,f) pathwayInfoOutput(el,f,',',',');
 /* Print out pathwayInfo as a comma separated list including final comma. */
 
-void pathwayInfoJsonOutput(struct pathwayInfo *el, FILE *f);
-/* Print out pathwayInfo in JSON format. */
-
 #define TISSUES_NUM_COLS 2
 
 struct tissues
 /* All available issues */
@@ -319,11 +310,8 @@
 
 #define tissuesCommaOut(el,f) tissuesOutput(el,f,',',',');
 /* Print out tissues as a comma separated list including final comma. */
 
-void tissuesJsonOutput(struct tissues *el, FILE *f);
-/* Print out tissues in JSON format. */
-
 #define DATATYPES_NUM_COLS 3
 
 struct dataTypes
 /* All available data types */
@@ -399,11 +387,8 @@
 
 #define dataTypesCommaOut(el,f) dataTypesOutput(el,f,',',',');
 /* Print out dataTypes as a comma separated list including final comma. */
 
-void dataTypesJsonOutput(struct dataTypes *el, FILE *f);
-/* Print out dataTypes in JSON format. */
-
 #define DATASETS_NUM_COLS 8
 
 struct datasets
 /* All available datasets */
@@ -484,11 +469,8 @@
 
 #define datasetsCommaOut(el,f) datasetsOutput(el,f,',',',');
 /* Print out datasets as a comma separated list including final comma. */
 
-void datasetsJsonOutput(struct datasets *el, FILE *f);
-/* Print out datasets in JSON format. */
-
 #define COHORTS_NUM_COLS 2
 
 struct cohorts
 /* All cohorts */
@@ -563,11 +545,8 @@
 
 #define cohortsCommaOut(el,f) cohortsOutput(el,f,',',',');
 /* Print out cohorts as a comma separated list including final comma. */
 
-void cohortsJsonOutput(struct cohorts *el, FILE *f);
-/* Print out cohorts in JSON format. */
-
 #define DATASETCOHORT_NUM_COLS 2
 
 struct datasetCohort
 /* Dataset cohort lookup */
@@ -642,11 +621,8 @@
 
 #define datasetCohortCommaOut(el,f) datasetCohortOutput(el,f,',',',');
 /* Print out datasetCohort as a comma separated list including final comma. */
 
-void datasetCohortJsonOutput(struct datasetCohort *el, FILE *f);
-/* Print out datasetCohort in JSON format. */
-
 #define GENELOOKUP_NUM_COLS 2
 
 struct geneLookup
 /* Lookup table linking knownGene */
@@ -721,11 +697,8 @@
 
 #define geneLookupCommaOut(el,f) geneLookupOutput(el,f,',',',');
 /* Print out geneLookup as a comma separated list including final comma. */
 
-void geneLookupJsonOutput(struct geneLookup *el, FILE *f);
-/* Print out geneLookup in JSON format. */
-
 #define PROBEINFO_NUM_COLS 5
 
 struct probeInfo
 /* Probe Information */
@@ -803,11 +776,8 @@
 
 #define probeInfoCommaOut(el,f) probeInfoOutput(el,f,',',',');
 /* Print out probeInfo as a comma separated list including final comma. */
 
-void probeInfoJsonOutput(struct probeInfo *el, FILE *f);
-/* Print out probeInfo in JSON format. */
-
 #define PROBETOGENE_NUM_COLS 2
 
 struct probeToGene
 /* Lookup table linking probe id and gene id */
@@ -882,11 +852,8 @@
 
 #define probeToGeneCommaOut(el,f) probeToGeneOutput(el,f,',',',');
 /* Print out probeToGene as a comma separated list including final comma. */
 
-void probeToGeneJsonOutput(struct probeToGene *el, FILE *f);
-/* Print out probeToGene in JSON format. */
-
 #define PROBESAMPLEVAL_NUM_COLS 3
 
 struct probeSampleVal
 /* Probe values for single sample */
@@ -962,11 +929,8 @@
 
 #define probeSampleValCommaOut(el,f) probeSampleValOutput(el,f,',',',');
 /* Print out probeSampleVal as a comma separated list including final comma. */
 
-void probeSampleValJsonOutput(struct probeSampleVal *el, FILE *f);
-/* Print out probeSampleVal in JSON format. */
-
 #define PROBEVALS_NUM_COLS 3
 
 struct probeVals
 /* Probe values for all samples */
@@ -1038,11 +1002,8 @@
 
 #define probeValsCommaOut(el,f) probeValsOutput(el,f,',',',');
 /* Print out probeVals as a comma separated list including final comma. */
 
-void probeValsJsonOutput(struct probeVals *el, FILE *f);
-/* Print out probeVals in JSON format. */
-
 #define SAMPLES_NUM_COLS 7
 
 struct samples
 /* All sample info */
@@ -1122,11 +1083,8 @@
 
 #define samplesCommaOut(el,f) samplesOutput(el,f,',',',');
 /* Print out samples as a comma separated list including final comma. */
 
-void samplesJsonOutput(struct samples *el, FILE *f);
-/* Print out samples in JSON format. */
-
 #define FEATURES_NUM_COLS 4
 
 struct features
 /* All Features */
@@ -1203,11 +1161,8 @@
 
 #define featuresCommaOut(el,f) featuresOutput(el,f,',',',');
 /* Print out features as a comma separated list including final comma. */
 
-void featuresJsonOutput(struct features *el, FILE *f);
-/* Print out features in JSON format. */
-
 #define CLINICALDATA_NUM_COLS 4
 
 struct clinicalData
 /* All clinical data */
@@ -1284,11 +1239,8 @@
 
 #define clinicalDataCommaOut(el,f) clinicalDataOutput(el,f,',',',');
 /* Print out clinicalData as a comma separated list including final comma. */
 
-void clinicalDataJsonOutput(struct clinicalData *el, FILE *f);
-/* Print out clinicalData in JSON format. */
-
 #define ANALYSES_NUM_COLS 5
 
 struct analyses
 /* All analyses run */
@@ -1366,11 +1318,8 @@
 
 #define analysesCommaOut(el,f) analysesOutput(el,f,',',',');
 /* Print out analyses as a comma separated list including final comma. */
 
-void analysesJsonOutput(struct analyses *el, FILE *f);
-/* Print out analyses in JSON format. */
-
 #define ANALYSISMODULES_NUM_COLS 3
 
 struct analysisModules
 /* All analysis modules */
@@ -1446,11 +1395,8 @@
 
 #define analysisModulesCommaOut(el,f) analysisModulesOutput(el,f,',',',');
 /* Print out analysisModules as a comma separated list including final comma. */
 
-void analysisModulesJsonOutput(struct analysisModules *el, FILE *f);
-/* Print out analysisModules in JSON format. */
-
 #define ANALYSISPARAMS_NUM_COLS 3
 
 struct analysisParams
 /* All analysis parameters */
@@ -1526,11 +1472,8 @@
 
 #define analysisParamsCommaOut(el,f) analysisParamsOutput(el,f,',',',');
 /* Print out analysisParams as a comma separated list including final comma. */
 
-void analysisParamsJsonOutput(struct analysisParams *el, FILE *f);
-/* Print out analysisParams in JSON format. */
-
 #define ANALYSISFEATURES_NUM_COLS 2
 
 struct analysisFeatures
 /* All analysis features */
@@ -1605,11 +1548,8 @@
 
 #define analysisFeaturesCommaOut(el,f) analysisFeaturesOutput(el,f,',',',');
 /* Print out analysisFeatures as a comma separated list including final comma. */
 
-void analysisFeaturesJsonOutput(struct analysisFeatures *el, FILE *f);
-/* Print out analysisFeatures in JSON format. */
-
 #define ANALYSISVALS_NUM_COLS 4
 
 struct analysisVals
 /* All analysis vals */
@@ -1686,10 +1626,160 @@
 
 #define analysisValsCommaOut(el,f) analysisValsOutput(el,f,',',',');
 /* Print out analysisVals as a comma separated list including final comma. */
 
-void analysisValsJsonOutput(struct analysisVals *el, FILE *f);
-/* Print out analysisVals in JSON format. */
+#define COHORTCORR_NUM_COLS 2
+
+struct cohortCorr
+/* Cohort Correlation tables */
+    {
+    struct cohortCorr *next;  /* Next in singly linked list. */
+    unsigned cohort_id;	/* Cohort Id */
+    char *result_table;	/* Result Table */
+    };
+
+void cohortCorrStaticLoad(char **row, struct cohortCorr *ret);
+/* Load a row from cohortCorr table into ret.  The contents of ret will
+ * be replaced at the next call to this function. */
+
+struct cohortCorr *cohortCorrLoad(char **row);
+/* Load a cohortCorr from row fetched with select * from cohortCorr
+ * from database.  Dispose of this with cohortCorrFree(). */
+
+struct cohortCorr *cohortCorrLoadAll(char *fileName);
+/* Load all cohortCorr from whitespace-separated file.
+ * Dispose of this with cohortCorrFreeList(). */
+
+struct cohortCorr *cohortCorrLoadAllByChar(char *fileName, char chopper);
+/* Load all cohortCorr from chopper separated file.
+ * Dispose of this with cohortCorrFreeList(). */
+
+#define cohortCorrLoadAllByTab(a) cohortCorrLoadAllByChar(a, '\t');
+/* Load all cohortCorr from tab separated file.
+ * Dispose of this with cohortCorrFreeList(). */
+
+struct cohortCorr *cohortCorrLoadByQuery(struct sqlConnection *conn, char *query);
+/* Load all cohortCorr from table that satisfy the query given.  
+ * Where query is of the form 'select * from example where something=something'
+ * or 'select example.* from example, anotherTable where example.something = 
+ * anotherTable.something'.
+ * Dispose of this with cohortCorrFreeList(). */
+
+void cohortCorrSaveToDb(struct sqlConnection *conn, struct cohortCorr *el, char *tableName, int updateSize);
+/* Save cohortCorr as a row to the table specified by tableName. 
+ * As blob fields may be arbitrary size updateSize specifies the approx size
+ * of a string that would contain the entire query. Arrays of native types are
+ * converted to comma separated strings and loaded as such, User defined types are
+ * inserted as NULL. Note that strings must be escaped to allow insertion into the database.
+ * For example "autosql's features include" --> "autosql\'s features include" 
+ * If worried about this use cohortCorrSaveToDbEscaped() */
+
+void cohortCorrSaveToDbEscaped(struct sqlConnection *conn, struct cohortCorr *el, char *tableName, int updateSize);
+/* Save cohortCorr as a row to the table specified by tableName. 
+ * As blob fields may be arbitrary size updateSize specifies the approx size.
+ * of a string that would contain the entire query. Automatically 
+ * escapes all simple strings (not arrays of string) but may be slower than cohortCorrSaveToDb().
+ * For example automatically copies and converts: 
+ * "autosql's features include" --> "autosql\'s features include" 
+ * before inserting into database. */ 
+
+struct cohortCorr *cohortCorrCommaIn(char **pS, struct cohortCorr *ret);
+/* Create a cohortCorr out of a comma separated string. 
+ * This will fill in ret if non-null, otherwise will
+ * return a new cohortCorr */
+
+void cohortCorrFree(struct cohortCorr **pEl);
+/* Free a single dynamically allocated cohortCorr such as created
+ * with cohortCorrLoad(). */
+
+void cohortCorrFreeList(struct cohortCorr **pList);
+/* Free a list of dynamically allocated cohortCorr's */
+
+void cohortCorrOutput(struct cohortCorr *el, FILE *f, char sep, char lastSep);
+/* Print out cohortCorr.  Separate fields with sep. Follow last field with lastSep. */
+
+#define cohortCorrTabOut(el,f) cohortCorrOutput(el,f,'\t','\n');
+/* Print out cohortCorr as a line in a tab-separated file. */
+
+#define cohortCorrCommaOut(el,f) cohortCorrOutput(el,f,',',',');
+/* Print out cohortCorr as a comma separated list including final comma. */
+
+#define CORRRESULTS_NUM_COLS 3
+
+struct corrResults
+/* Correlation results */
+    {
+    struct corrResults *next;  /* Next in singly linked list. */
+    unsigned feature_id1;	/* Feature Id1 */
+    unsigned feature_id2;	/* Feature Id2 */
+    float val;	/* Correlation Value */
+    };
+
+void corrResultsStaticLoad(char **row, struct corrResults *ret);
+/* Load a row from corrResults table into ret.  The contents of ret will
+ * be replaced at the next call to this function. */
+
+struct corrResults *corrResultsLoad(char **row);
+/* Load a corrResults from row fetched with select * from corrResults
+ * from database.  Dispose of this with corrResultsFree(). */
+
+struct corrResults *corrResultsLoadAll(char *fileName);
+/* Load all corrResults from whitespace-separated file.
+ * Dispose of this with corrResultsFreeList(). */
+
+struct corrResults *corrResultsLoadAllByChar(char *fileName, char chopper);
+/* Load all corrResults from chopper separated file.
+ * Dispose of this with corrResultsFreeList(). */
+
+#define corrResultsLoadAllByTab(a) corrResultsLoadAllByChar(a, '\t');
+/* Load all corrResults from tab separated file.
+ * Dispose of this with corrResultsFreeList(). */
+
+struct corrResults *corrResultsLoadByQuery(struct sqlConnection *conn, char *query);
+/* Load all corrResults from table that satisfy the query given.  
+ * Where query is of the form 'select * from example where something=something'
+ * or 'select example.* from example, anotherTable where example.something = 
+ * anotherTable.something'.
+ * Dispose of this with corrResultsFreeList(). */
+
+void corrResultsSaveToDb(struct sqlConnection *conn, struct corrResults *el, char *tableName, int updateSize);
+/* Save corrResults as a row to the table specified by tableName. 
+ * As blob fields may be arbitrary size updateSize specifies the approx size
+ * of a string that would contain the entire query. Arrays of native types are
+ * converted to comma separated strings and loaded as such, User defined types are
+ * inserted as NULL. Note that strings must be escaped to allow insertion into the database.
+ * For example "autosql's features include" --> "autosql\'s features include" 
+ * If worried about this use corrResultsSaveToDbEscaped() */
+
+void corrResultsSaveToDbEscaped(struct sqlConnection *conn, struct corrResults *el, char *tableName, int updateSize);
+/* Save corrResults as a row to the table specified by tableName. 
+ * As blob fields may be arbitrary size updateSize specifies the approx size.
+ * of a string that would contain the entire query. Automatically 
+ * escapes all simple strings (not arrays of string) but may be slower than corrResultsSaveToDb().
+ * For example automatically copies and converts: 
+ * "autosql's features include" --> "autosql\'s features include" 
+ * before inserting into database. */ 
+
+struct corrResults *corrResultsCommaIn(char **pS, struct corrResults *ret);
+/* Create a corrResults out of a comma separated string. 
+ * This will fill in ret if non-null, otherwise will
+ * return a new corrResults */
+
+void corrResultsFree(struct corrResults **pEl);
+/* Free a single dynamically allocated corrResults such as created
+ * with corrResultsLoad(). */
+
+void corrResultsFreeList(struct corrResults **pList);
+/* Free a list of dynamically allocated corrResults's */
+
+void corrResultsOutput(struct corrResults *el, FILE *f, char sep, char lastSep);
+/* Print out corrResults.  Separate fields with sep. Follow last field with lastSep. */
+
+#define corrResultsTabOut(el,f) corrResultsOutput(el,f,'\t','\n');
+/* Print out corrResults as a line in a tab-separated file. */
+
+#define corrResultsCommaOut(el,f) corrResultsOutput(el,f,',',',');
+/* Print out corrResults as a comma separated list including final comma. */
 
 /* -------------------------------- End autoSql Generated Code -------------------------------- */
 
 #endif /* BIOINTDB_H */