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

1.3 2009/03/22 01:07:28 jsanborn
updated
Index: src/hg/instinct/bioInt2/bioIntDb.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/bioInt2/bioIntDb.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -B -U 4 -r1.2 -r1.3
--- src/hg/instinct/bioInt2/bioIntDb.h	21 Mar 2009 19:54:10 -0000	1.2
+++ src/hg/instinct/bioInt2/bioIntDb.h	22 Mar 2009 01:07:28 -0000	1.3
@@ -1239,18 +1239,19 @@
 
 #define clinicalDataCommaOut(el,f) clinicalDataOutput(el,f,',',',');
 /* Print out clinicalData as a comma separated list including final comma. */
 
-#define ANALYSES_NUM_COLS 4
+#define ANALYSES_NUM_COLS 5
 
 struct analyses
 /* All analyses run */
     {
     struct analyses *next;  /* Next in singly linked list. */
     unsigned id;	/* Analysis id */
     unsigned cohort_id;	/* Cohort Id */
-    char *module;	/* Analysis Module */
+    unsigned module_id;	/* Module Id */
     char *result_table;	/* Table containing result */
+    char *input_tables;	/* Comma-separated list of input tables */
     };
 
 void analysesStaticLoad(char **row, struct analyses *ret);
 /* Load a row from analyses table into ret.  The contents of ret will
@@ -1317,16 +1318,93 @@
 
 #define analysesCommaOut(el,f) analysesOutput(el,f,',',',');
 /* Print out analyses as a comma separated list including final comma. */
 
+#define ANALYSISMODULES_NUM_COLS 3
+
+struct analysisModules
+/* All analysis modules */
+    {
+    struct analysisModules *next;  /* Next in singly linked list. */
+    unsigned id;	/* Module Id */
+    char *name;	/* Module Name */
+    char *type;	/* Module Type (gene, geneset, etc.) */
+    };
+
+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. */
+
+struct analysisModules *analysisModulesLoad(char **row);
+/* Load a analysisModules from row fetched with select * from analysisModules
+ * from database.  Dispose of this with analysisModulesFree(). */
+
+struct analysisModules *analysisModulesLoadAll(char *fileName);
+/* Load all analysisModules from whitespace-separated file.
+ * Dispose of this with analysisModulesFreeList(). */
+
+struct analysisModules *analysisModulesLoadAllByChar(char *fileName, char chopper);
+/* Load all analysisModules from chopper separated file.
+ * Dispose of this with analysisModulesFreeList(). */
+
+#define analysisModulesLoadAllByTab(a) analysisModulesLoadAllByChar(a, '\t');
+/* Load all analysisModules from tab separated file.
+ * Dispose of this with analysisModulesFreeList(). */
+
+struct analysisModules *analysisModulesLoadByQuery(struct sqlConnection *conn, char *query);
+/* Load all analysisModules 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 analysisModulesFreeList(). */
+
+void analysisModulesSaveToDb(struct sqlConnection *conn, struct analysisModules *el, char *tableName, int updateSize);
+/* Save analysisModules 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 analysisModulesSaveToDbEscaped() */
+
+void analysisModulesSaveToDbEscaped(struct sqlConnection *conn, struct analysisModules *el, char *tableName, int updateSize);
+/* Save analysisModules 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 analysisModulesSaveToDb().
+ * For example automatically copies and converts: 
+ * "autosql's features include" --> "autosql\'s features include" 
+ * before inserting into database. */ 
+
+struct analysisModules *analysisModulesCommaIn(char **pS, struct analysisModules *ret);
+/* Create a analysisModules out of a comma separated string. 
+ * This will fill in ret if non-null, otherwise will
+ * return a new analysisModules */
+
+void analysisModulesFree(struct analysisModules **pEl);
+/* Free a single dynamically allocated analysisModules such as created
+ * with analysisModulesLoad(). */
+
+void analysisModulesFreeList(struct analysisModules **pList);
+/* Free a list of dynamically allocated analysisModules's */
+
+void analysisModulesOutput(struct analysisModules *el, FILE *f, char sep, char lastSep);
+/* Print out analysisModules.  Separate fields with sep. Follow last field with lastSep. */
+
+#define analysisModulesTabOut(el,f) analysisModulesOutput(el,f,'\t','\n');
+/* Print out analysisModules as a line in a tab-separated file. */
+
+#define analysisModulesCommaOut(el,f) analysisModulesOutput(el,f,',',',');
+/* Print out analysisModules as a comma separated list including final comma. */
+
 #define ANALYSISPARAMS_NUM_COLS 3
 
 struct analysisParams
 /* All analysis parameters */
     {
     struct analysisParams *next;  /* Next in singly linked list. */
-    unsigned analysis_id;	/* Module Id */
-    char *key;	/* Parameter key */
+    unsigned analysis_id;	/* Analysis Id */
+    char *name;	/* Parameter name */
     char *val;	/* Parameter val */
     };
 
 void analysisParamsStaticLoad(char **row, struct analysisParams *ret);