src/hg/instinct/bioInt2/bioIntDb.c 1.9
1.9 2009/09/05 01:12:01 sbenz
Added em to pipeline
Index: src/hg/instinct/bioInt2/bioIntDb.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/bioInt2/bioIntDb.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -b -B -U 4 -r1.8 -r1.9
--- src/hg/instinct/bioInt2/bioIntDb.c 30 Apr 2009 19:54:28 -0000 1.8
+++ src/hg/instinct/bioInt2/bioIntDb.c 5 Sep 2009 01:12:01 -0000 1.9
@@ -3635,6 +3635,67 @@
fprintf(f, "%g", el->val);
fputc(lastSep,f);
}
+struct pathwayEMParams *pathwayEMParamsLoad(char **row)
+/* Load a pathwayEMParams from row fetched with select * from pathwayEMParams
+ * from database. Dispose of this with pathwayEMParamsFree(). */
+{
+struct pathwayEMParams *ret;
+
+AllocVar(ret);
+ret->pathway_id = sqlUnsigned(row[0]);
+ret->cohort_id = sqlUnsigned(row[1]);
+ret->dataset_id = sqlUnsigned(row[2]);
+ret->parent_state = sqlUnsigned(row[3]);
+ret->child_state = sqlUnsigned(row[4]);
+ret->val = sqlFloat(row[5]);
+
+return ret;
+}
+
+struct pathwayEMParams *pathwayEMParamsLoadByQuery(struct sqlConnection *conn, char *query)
+/* Load all pathwayEMParams 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 pathwayEMParamsFreeList(). */
+{
+struct pathwayEMParams *list = NULL, *el;
+struct sqlResult *sr;
+char **row;
+
+sr = sqlGetResult(conn, query);
+while ((row = sqlNextRow(sr)) != NULL)
+ {
+ el = pathwayEMParamsLoad(row);
+ slAddHead(&list, el);
+ }
+slReverse(&list);
+sqlFreeResult(&sr);
+return list;
+}
+
+void pathwayEMParamsFree(struct pathwayEMParams **pEl)
+/* Free a single dynamically allocated corrResults such as created
+ * with pathwayEMParamsLoad(). */
+{
+struct pathwayEMParams *el;
+
+if ((el = *pEl) == NULL) return;
+freez(pEl);
+}
+
+void pathwayEMParamsFreeList(struct pathwayEMParams **pList)
+/* Free a list of dynamically allocated pathwayEMParams's */
+{
+struct pathwayEMParams *el, *next;
+
+for (el = *pList; el != NULL; el = next)
+ {
+ next = el->next;
+ pathwayEMParamsFree(&el);
+ }
+*pList = NULL;
+}
/* -------------------------------- End autoSql Generated Code -------------------------------- */