src/hg/instinct/inc/raDb.h 1.1

1.1 2010/04/12 17:16:27 jsanborn
added raDb functionality
Index: src/hg/instinct/inc/raDb.h
===================================================================
RCS file: src/hg/instinct/inc/raDb.h
diff -N src/hg/instinct/inc/raDb.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/hg/instinct/inc/raDb.h	12 Apr 2010 17:16:27 -0000	1.1
@@ -0,0 +1,121 @@
+/* raDb.h was originally generated by the autoSql program, which also 
+ * generated raDb.c and raDb.sql.  This header links the database and
+ * the RAM representation of objects. */
+
+#ifndef RADB_H
+#define RADB_H
+
+#include "jksql.h"
+#define RADB_NUM_COLS 32
+
+struct raDb
+/* ra info */
+    {
+    struct raDb *next;  /* Next in singly linked list. */
+    unsigned *id;	/* Unique id */
+    char *name;	/* Table name for genomic data */
+    char *accessTable;	/* Down-sampled table */
+    char *shortLabel;	/* Short label */
+    char *longLabel;	/* Long label */
+    unsigned *expCount;	/* Number of samples */
+    unsigned *height;	/* Image Height (only for bed 4) */
+    char *groupName;	/* Group name */
+    char *raFile;	/* RA file containing clinical info */
+    char *patDb;	/* Clinical info db */
+    char *sampleField;	/* Sample field */
+    char *patTable;	/* Patient to sample mapping */
+    char *patField;	/* Patient field */
+    char *aliasTable;	/* Probe to gene mapping */
+    char *displayNameTable;	/* Display names for aliases */
+    char *dataType;	/* data type (bed 15) */
+    char *platform;	/* Expression, SNP, etc. */
+    float *expScale;	/* Scaling factor */
+    float *gainFull;	/* Gain Full */
+    float *gainSet;	/* Gain Set */
+    char *type;	/* Unknown */
+    char *visibility;	/* Default visibility */
+    float *priority;	/* Priority for sorting */
+    char *url;	/* Pubmed URL */
+    char *security;	/* Security setting (public, private) */
+    char *local_url;	/* URL to local details page */
+    char *profile;	/* Database profile */
+    char *wrangler;	/* Wrangler */
+    char *citation;	/* Citation */
+    char *article_title;	/* Title of publication */
+    char *author_list;	/* Author list */
+    char *wrangling_procedure;	/* Wrangling */
+    };
+
+void raDbStaticLoadWithNull(char **row, struct raDb *ret);
+/* Load a row from raDb table into ret.  The contents of ret will
+ * be replaced at the next call to this function. */
+
+struct raDb *raDbLoadByQuery(struct sqlConnection *conn, char *query);
+/* Load all raDb 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 raDbFreeList(). */
+
+void raDbSaveToDb(struct sqlConnection *conn, struct raDb *el, char *tableName, int updateSize);
+/* Save raDb 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 raDbSaveToDbEscaped() */
+
+void raDbSaveToDbEscaped(struct sqlConnection *conn, struct raDb *el, char *tableName, int updateSize);
+/* Save raDb 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 raDbSaveToDb().
+ * For example automatically copies and converts: 
+ * "autosql's features include" --> "autosql\'s features include" 
+ * before inserting into database. */ 
+
+struct raDb *raDbLoadWithNull(char **row);
+/* Load a raDb from row fetched with select * from raDb
+ * from database.  Dispose of this with raDbFree(). */
+
+struct raDb *raDbLoadAll(char *fileName);
+/* Load all raDb from whitespace-separated file.
+ * Dispose of this with raDbFreeList(). */
+
+struct raDb *raDbLoadAllByChar(char *fileName, char chopper);
+/* Load all raDb from chopper separated file.
+ * Dispose of this with raDbFreeList(). */
+
+#define raDbLoadAllByTab(a) raDbLoadAllByChar(a, '\t');
+/* Load all raDb from tab separated file.
+ * Dispose of this with raDbFreeList(). */
+
+struct raDb *raDbCommaIn(char **pS, struct raDb *ret);
+/* Create a raDb out of a comma separated string. 
+ * This will fill in ret if non-null, otherwise will
+ * return a new raDb */
+
+void raDbFree(struct raDb **pEl);
+/* Free a single dynamically allocated raDb such as created
+ * with raDbLoad(). */
+
+void raDbFreeList(struct raDb **pList);
+/* Free a list of dynamically allocated raDb's */
+
+void raDbOutput(struct raDb *el, FILE *f, char sep, char lastSep);
+/* Print out raDb.  Separate fields with sep. Follow last field with lastSep. */
+
+#define raDbTabOut(el,f) raDbOutput(el,f,'\t','\n');
+/* Print out raDb as a line in a tab-separated file. */
+
+#define raDbCommaOut(el,f) raDbOutput(el,f,',',',');
+/* Print out raDb as a comma separated list including final comma. */
+
+void raDbJsonOutput(struct raDb *el, FILE *f);
+/* Print out raDb in JSON format. */
+
+/* -------------------------------- End autoSql Generated Code -------------------------------- */
+
+#endif /* RADB_H */
+