src/hg/instinct/lib/tcgaTableDefs.c 1.2

1.2 2009/06/04 03:42:50 jsanborn
added copyright notices, removed cluster library
Index: src/hg/instinct/lib/tcgaTableDefs.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/lib/tcgaTableDefs.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 1000000 -r1.1 -r1.2
--- src/hg/instinct/lib/tcgaTableDefs.c	9 May 2008 17:33:27 -0000	1.1
+++ src/hg/instinct/lib/tcgaTableDefs.c	4 Jun 2009 03:42:50 -0000	1.2
@@ -1,2374 +1,2378 @@
+/********************************************************************************/
+/* Copyright 2007-2009 -- The Regents of the University of California           */
+/********************************************************************************/
+
 /* tcgaTableDefs.c was originally generated by the autoSql program, which also 
  * generated tcgaTableDefs.h and tcgaTableDefs.sql.  This module links the database and
  * the RAM representation of objects. */
 
 #include "common.h"
 #include "linefile.h"
 #include "dystring.h"
 #include "jksql.h"
 #include "tcgaTableDefs.h"
 
 static char const rcsid[] = "$Id$";
 
 void subjInfoStaticLoadWithNull(char **row, struct subjInfo *ret)
 /* Load a row from subjInfo table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->subjId = row[0];
 ret->gender = row[1];
 ret->race = row[2];
 ret->dateOfBirth = row[3];
 ret->dateOfDeath = row[4];
 ret->informedConsentAcquired = row[5];
 ret->dateOfLastFollowUp = row[6];
 ret->examinationDate = row[7];
 if (row[8] != NULL)
     {
     ret->alcoholConsumption = needMem(sizeof(float));
     *(ret->alcoholConsumption) = sqlFloat(row[8]);
     }
 ret->vitalStatus = row[9];
 if (row[10] != NULL)
     {
     ret->smokingHistory = needMem(sizeof(float));
     *(ret->smokingHistory) = sqlFloat(row[10]);
     }
 }
 
 struct subjInfo *subjInfoLoadWithNull(char **row)
 /* Load a subjInfo from row fetched with select * from subjInfo
  * from database.  Dispose of this with subjInfoFree(). */
 {
 struct subjInfo *ret;
 
 AllocVar(ret);
 ret->subjId = cloneString(row[0]);
 ret->gender = cloneString(row[1]);
 ret->race = cloneString(row[2]);
 ret->dateOfBirth = cloneString(row[3]);
 ret->dateOfDeath = cloneString(row[4]);
 ret->informedConsentAcquired = cloneString(row[5]);
 ret->dateOfLastFollowUp = cloneString(row[6]);
 ret->examinationDate = cloneString(row[7]);
 if (row[8] != NULL)
     {
     ret->alcoholConsumption = needMem(sizeof(float));
     *(ret->alcoholConsumption) = sqlFloat(row[8]);
     }
 ret->vitalStatus = cloneString(row[9]);
 if (row[10] != NULL)
     {
     ret->smokingHistory = needMem(sizeof(float));
     *(ret->smokingHistory) = sqlFloat(row[10]);
     }
 return ret;
 }
 
 struct subjInfo *subjInfoLoadAll(char *fileName) 
 /* Load all subjInfo from a whitespace-separated file.
  * Dispose of this with subjInfoFreeList(). */
 {
 struct subjInfo *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[11];
 
 while (lineFileRow(lf, row))
     {
     el = subjInfoLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct subjInfo *subjInfoLoadAllByChar(char *fileName, char chopper) 
 /* Load all subjInfo from a chopper separated file.
  * Dispose of this with subjInfoFreeList(). */
 {
 struct subjInfo *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[11];
 
 while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
     {
     el = subjInfoLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct subjInfo *subjInfoLoadByQuery(struct sqlConnection *conn, char *query)
 /* Load all subjInfo 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 subjInfoFreeList(). */
 {
 struct subjInfo *list = NULL, *el;
 struct sqlResult *sr;
 char **row;
 
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     el = subjInfoLoadWithNull(row);
     slAddHead(&list, el);
     }
 slReverse(&list);
 sqlFreeResult(&sr);
 return list;
 }
 
 void subjInfoSaveToDb(struct sqlConnection *conn, struct subjInfo *el, char *tableName, int updateSize)
 /* Save subjInfo 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 subjInfoSaveToDbEscaped() */
 {
 struct dyString *update = newDyString(updateSize);
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s','%s','%s',%g,'%s',%g)", 
 	tableName,  el->subjId,  el->gender,  el->race,  el->dateOfBirth,  el->dateOfDeath,  el->informedConsentAcquired,  el->dateOfLastFollowUp,  el->examinationDate,  *(el->alcoholConsumption),  el->vitalStatus,  *(el->smokingHistory));
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 }
 
 void subjInfoSaveToDbEscaped(struct sqlConnection *conn, struct subjInfo *el, char *tableName, int updateSize)
 /* Save subjInfo 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 subjInfoSaveToDb().
  * For example automatically copies and converts: 
  * "autosql's features include" --> "autosql\'s features include" 
  * before inserting into database. */ 
 {
 struct dyString *update = newDyString(updateSize);
 char  *subjId, *gender, *race, *dateOfBirth, *dateOfDeath, *informedConsentAcquired, *dateOfLastFollowUp, *examinationDate, *vitalStatus;
 subjId = sqlEscapeString(el->subjId);
 gender = sqlEscapeString(el->gender);
 race = sqlEscapeString(el->race);
 dateOfBirth = sqlEscapeString(el->dateOfBirth);
 dateOfDeath = sqlEscapeString(el->dateOfDeath);
 informedConsentAcquired = sqlEscapeString(el->informedConsentAcquired);
 dateOfLastFollowUp = sqlEscapeString(el->dateOfLastFollowUp);
 examinationDate = sqlEscapeString(el->examinationDate);
 vitalStatus = sqlEscapeString(el->vitalStatus);
 
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s','%s','%s',%g,'%s',%g)", 
 	tableName,  subjId,  gender,  race,  dateOfBirth,  dateOfDeath,  informedConsentAcquired,  dateOfLastFollowUp,  examinationDate,  *(el->alcoholConsumption),  vitalStatus,  *(el->smokingHistory));
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&subjId);
 freez(&gender);
 freez(&race);
 freez(&dateOfBirth);
 freez(&dateOfDeath);
 freez(&informedConsentAcquired);
 freez(&dateOfLastFollowUp);
 freez(&examinationDate);
 freez(&vitalStatus);
 }
 
 struct subjInfo *subjInfoCommaIn(char **pS, struct subjInfo *ret)
 /* Create a subjInfo out of a comma separated string. 
  * This will fill in ret if non-null, otherwise will
  * return a new subjInfo */
 {
 char *s = *pS;
 
 if (ret == NULL)
     AllocVar(ret);
 ret->subjId = sqlStringComma(&s);
 ret->gender = sqlStringComma(&s);
 ret->race = sqlStringComma(&s);
 ret->dateOfBirth = sqlStringComma(&s);
 ret->dateOfDeath = sqlStringComma(&s);
 ret->informedConsentAcquired = sqlStringComma(&s);
 ret->dateOfLastFollowUp = sqlStringComma(&s);
 ret->examinationDate = sqlStringComma(&s);
 ret->alcoholConsumption = needMem(sizeof(*(ret->alcoholConsumption)));
 *(ret->alcoholConsumption) = sqlFloatComma(&s);
 ret->vitalStatus = sqlStringComma(&s);
 ret->smokingHistory = needMem(sizeof(*(ret->smokingHistory)));
 *(ret->smokingHistory) = sqlFloatComma(&s);
 *pS = s;
 return ret;
 }
 
 void subjInfoFree(struct subjInfo **pEl)
 /* Free a single dynamically allocated subjInfo such as created
  * with subjInfoLoad(). */
 {
 struct subjInfo *el;
 
 if ((el = *pEl) == NULL) return;
 freeMem(el->subjId);
 freeMem(el->gender);
 freeMem(el->race);
 freeMem(el->dateOfBirth);
 freeMem(el->dateOfDeath);
 freeMem(el->informedConsentAcquired);
 freeMem(el->dateOfLastFollowUp);
 freeMem(el->examinationDate);
 freeMem(el->vitalStatus);
 freez(pEl);
 }
 
 void subjInfoFreeList(struct subjInfo **pList)
 /* Free a list of dynamically allocated subjInfo's */
 {
 struct subjInfo *el, *next;
 
 for (el = *pList; el != NULL; el = next)
     {
     next = el->next;
     subjInfoFree(&el);
     }
 *pList = NULL;
 }
 
 void subjInfoOutput(struct subjInfo *el, FILE *f, char sep, char lastSep) 
 /* Print out subjInfo.  Separate fields with sep. Follow last field with lastSep. */
 {
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->subjId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->gender);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->race);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->dateOfBirth);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->dateOfDeath);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->informedConsentAcquired);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->dateOfLastFollowUp);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->examinationDate);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%g", *(el->alcoholConsumption));
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->vitalStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%g", *(el->smokingHistory));
 fputc(lastSep,f);
 }
 
 void tcgaXrefStaticLoadWithNull(char **row, struct tcgaXref *ret)
 /* Load a row from tcgaXref table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->subjId = row[0];
 ret->sampleId = row[1];
 ret->slideId = row[2];
 ret->AliquotId = row[3];
 ret->analyteId = row[4];
 ret->portionId = row[5];
 }
 
 struct tcgaXref *tcgaXrefLoadWithNull(char **row)
 /* Load a tcgaXref from row fetched with select * from tcgaXref
  * from database.  Dispose of this with tcgaXrefFree(). */
 {
 struct tcgaXref *ret;
 
 AllocVar(ret);
 ret->subjId = cloneString(row[0]);
 ret->sampleId = cloneString(row[1]);
 ret->slideId = cloneString(row[2]);
 ret->AliquotId = cloneString(row[3]);
 ret->analyteId = cloneString(row[4]);
 ret->portionId = cloneString(row[5]);
 return ret;
 }
 
 struct tcgaXref *tcgaXrefLoadAll(char *fileName) 
 /* Load all tcgaXref from a whitespace-separated file.
  * Dispose of this with tcgaXrefFreeList(). */
 {
 struct tcgaXref *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[6];
 
 while (lineFileRow(lf, row))
     {
     el = tcgaXrefLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct tcgaXref *tcgaXrefLoadAllByChar(char *fileName, char chopper) 
 /* Load all tcgaXref from a chopper separated file.
  * Dispose of this with tcgaXrefFreeList(). */
 {
 struct tcgaXref *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[6];
 
 while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
     {
     el = tcgaXrefLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct tcgaXref *tcgaXrefLoadByQuery(struct sqlConnection *conn, char *query)
 /* Load all tcgaXref 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 tcgaXrefFreeList(). */
 {
 struct tcgaXref *list = NULL, *el;
 struct sqlResult *sr;
 char **row;
 
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     el = tcgaXrefLoadWithNull(row);
     slAddHead(&list, el);
     }
 slReverse(&list);
 sqlFreeResult(&sr);
 return list;
 }
 
 void tcgaXrefSaveToDb(struct sqlConnection *conn, struct tcgaXref *el, char *tableName, int updateSize)
 /* Save tcgaXref 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 tcgaXrefSaveToDbEscaped() */
 {
 struct dyString *update = newDyString(updateSize);
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s')", 
 	tableName,  el->subjId,  el->sampleId,  el->slideId,  el->AliquotId,  el->analyteId,  el->portionId);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 }
 
 void tcgaXrefSaveToDbEscaped(struct sqlConnection *conn, struct tcgaXref *el, char *tableName, int updateSize)
 /* Save tcgaXref 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 tcgaXrefSaveToDb().
  * For example automatically copies and converts: 
  * "autosql's features include" --> "autosql\'s features include" 
  * before inserting into database. */ 
 {
 struct dyString *update = newDyString(updateSize);
 char  *subjId, *sampleId, *slideId, *AliquotId, *analyteId, *portionId;
 subjId = sqlEscapeString(el->subjId);
 sampleId = sqlEscapeString(el->sampleId);
 slideId = sqlEscapeString(el->slideId);
 AliquotId = sqlEscapeString(el->AliquotId);
 analyteId = sqlEscapeString(el->analyteId);
 portionId = sqlEscapeString(el->portionId);
 
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s')", 
 	tableName,  subjId,  sampleId,  slideId,  AliquotId,  analyteId,  portionId);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&subjId);
 freez(&sampleId);
 freez(&slideId);
 freez(&AliquotId);
 freez(&analyteId);
 freez(&portionId);
 }
 
 struct tcgaXref *tcgaXrefCommaIn(char **pS, struct tcgaXref *ret)
 /* Create a tcgaXref out of a comma separated string. 
  * This will fill in ret if non-null, otherwise will
  * return a new tcgaXref */
 {
 char *s = *pS;
 
 if (ret == NULL)
     AllocVar(ret);
 ret->subjId = sqlStringComma(&s);
 ret->sampleId = sqlStringComma(&s);
 ret->slideId = sqlStringComma(&s);
 ret->AliquotId = sqlStringComma(&s);
 ret->analyteId = sqlStringComma(&s);
 ret->portionId = sqlStringComma(&s);
 *pS = s;
 return ret;
 }
 
 void tcgaXrefFree(struct tcgaXref **pEl)
 /* Free a single dynamically allocated tcgaXref such as created
  * with tcgaXrefLoad(). */
 {
 struct tcgaXref *el;
 
 if ((el = *pEl) == NULL) return;
 freeMem(el->subjId);
 freeMem(el->sampleId);
 freeMem(el->slideId);
 freeMem(el->AliquotId);
 freeMem(el->analyteId);
 freeMem(el->portionId);
 freez(pEl);
 }
 
 void tcgaXrefFreeList(struct tcgaXref **pList)
 /* Free a list of dynamically allocated tcgaXref's */
 {
 struct tcgaXref *el, *next;
 
 for (el = *pList; el != NULL; el = next)
     {
     next = el->next;
     tcgaXrefFree(&el);
     }
 *pList = NULL;
 }
 
 void tcgaXrefOutput(struct tcgaXref *el, FILE *f, char sep, char lastSep) 
 /* Print out tcgaXref.  Separate fields with sep. Follow last field with lastSep. */
 {
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->subjId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->sampleId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->slideId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->AliquotId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->analyteId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->portionId);
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
 void statusStaticLoadWithNull(char **row, struct status *ret)
 /* Load a row from status table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->subjId = row[0];
 ret->tnmRecurrenceTumorStatus = row[1];
 ret->tnmRecurrenceMetastaticStatus = row[2];
 ret->tnmClinicalTumorStatus = row[3];
 ret->tnmRecurrenceLymphnodeStatus = row[4];
 ret->tnmPathologyMetastaticStatus = row[5];
 ret->tnmClinicalMetastaticStatus = row[6];
 ret->tnmPathologyTumorStatus = row[7];
 ret->tnmClinicalLymphnodeStatus = row[8];
 ret->tnmPathologyLymphnodeStatus = row[9];
 ret->progressionStatus = row[10];
 ret->vitalStatus = row[11];
 }
 
 struct status *statusLoadWithNull(char **row)
 /* Load a status from row fetched with select * from status
  * from database.  Dispose of this with statusFree(). */
 {
 struct status *ret;
 
 AllocVar(ret);
 ret->subjId = cloneString(row[0]);
 ret->tnmRecurrenceTumorStatus = cloneString(row[1]);
 ret->tnmRecurrenceMetastaticStatus = cloneString(row[2]);
 ret->tnmClinicalTumorStatus = cloneString(row[3]);
 ret->tnmRecurrenceLymphnodeStatus = cloneString(row[4]);
 ret->tnmPathologyMetastaticStatus = cloneString(row[5]);
 ret->tnmClinicalMetastaticStatus = cloneString(row[6]);
 ret->tnmPathologyTumorStatus = cloneString(row[7]);
 ret->tnmClinicalLymphnodeStatus = cloneString(row[8]);
 ret->tnmPathologyLymphnodeStatus = cloneString(row[9]);
 ret->progressionStatus = cloneString(row[10]);
 ret->vitalStatus = cloneString(row[11]);
 return ret;
 }
 
 struct status *statusLoadAll(char *fileName) 
 /* Load all status from a whitespace-separated file.
  * Dispose of this with statusFreeList(). */
 {
 struct status *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[12];
 
 while (lineFileRow(lf, row))
     {
     el = statusLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct status *statusLoadAllByChar(char *fileName, char chopper) 
 /* Load all status from a chopper separated file.
  * Dispose of this with statusFreeList(). */
 {
 struct status *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[12];
 
 while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
     {
     el = statusLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct status *statusLoadByQuery(struct sqlConnection *conn, char *query)
 /* Load all status 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 statusFreeList(). */
 {
 struct status *list = NULL, *el;
 struct sqlResult *sr;
 char **row;
 
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     el = statusLoadWithNull(row);
     slAddHead(&list, el);
     }
 slReverse(&list);
 sqlFreeResult(&sr);
 return list;
 }
 
 void statusSaveToDb(struct sqlConnection *conn, struct status *el, char *tableName, int updateSize)
 /* Save status 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 statusSaveToDbEscaped() */
 {
 struct dyString *update = newDyString(updateSize);
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", 
 	tableName,  el->subjId,  el->tnmRecurrenceTumorStatus,  el->tnmRecurrenceMetastaticStatus,  el->tnmClinicalTumorStatus,  el->tnmRecurrenceLymphnodeStatus,  el->tnmPathologyMetastaticStatus,  el->tnmClinicalMetastaticStatus,  el->tnmPathologyTumorStatus,  el->tnmClinicalLymphnodeStatus,  el->tnmPathologyLymphnodeStatus,  el->progressionStatus,  el->vitalStatus);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 }
 
 void statusSaveToDbEscaped(struct sqlConnection *conn, struct status *el, char *tableName, int updateSize)
 /* Save status 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 statusSaveToDb().
  * For example automatically copies and converts: 
  * "autosql's features include" --> "autosql\'s features include" 
  * before inserting into database. */ 
 {
 struct dyString *update = newDyString(updateSize);
 char  *subjId, *tnmRecurrenceTumorStatus, *tnmRecurrenceMetastaticStatus, *tnmClinicalTumorStatus, *tnmRecurrenceLymphnodeStatus, *tnmPathologyMetastaticStatus, *tnmClinicalMetastaticStatus, *tnmPathologyTumorStatus, *tnmClinicalLymphnodeStatus, *tnmPathologyLymphnodeStatus, *progressionStatus, *vitalStatus;
 subjId = sqlEscapeString(el->subjId);
 tnmRecurrenceTumorStatus = sqlEscapeString(el->tnmRecurrenceTumorStatus);
 tnmRecurrenceMetastaticStatus = sqlEscapeString(el->tnmRecurrenceMetastaticStatus);
 tnmClinicalTumorStatus = sqlEscapeString(el->tnmClinicalTumorStatus);
 tnmRecurrenceLymphnodeStatus = sqlEscapeString(el->tnmRecurrenceLymphnodeStatus);
 tnmPathologyMetastaticStatus = sqlEscapeString(el->tnmPathologyMetastaticStatus);
 tnmClinicalMetastaticStatus = sqlEscapeString(el->tnmClinicalMetastaticStatus);
 tnmPathologyTumorStatus = sqlEscapeString(el->tnmPathologyTumorStatus);
 tnmClinicalLymphnodeStatus = sqlEscapeString(el->tnmClinicalLymphnodeStatus);
 tnmPathologyLymphnodeStatus = sqlEscapeString(el->tnmPathologyLymphnodeStatus);
 progressionStatus = sqlEscapeString(el->progressionStatus);
 vitalStatus = sqlEscapeString(el->vitalStatus);
 
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", 
 	tableName,  subjId,  tnmRecurrenceTumorStatus,  tnmRecurrenceMetastaticStatus,  tnmClinicalTumorStatus,  tnmRecurrenceLymphnodeStatus,  tnmPathologyMetastaticStatus,  tnmClinicalMetastaticStatus,  tnmPathologyTumorStatus,  tnmClinicalLymphnodeStatus,  tnmPathologyLymphnodeStatus,  progressionStatus,  vitalStatus);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&subjId);
 freez(&tnmRecurrenceTumorStatus);
 freez(&tnmRecurrenceMetastaticStatus);
 freez(&tnmClinicalTumorStatus);
 freez(&tnmRecurrenceLymphnodeStatus);
 freez(&tnmPathologyMetastaticStatus);
 freez(&tnmClinicalMetastaticStatus);
 freez(&tnmPathologyTumorStatus);
 freez(&tnmClinicalLymphnodeStatus);
 freez(&tnmPathologyLymphnodeStatus);
 freez(&progressionStatus);
 freez(&vitalStatus);
 }
 
 struct status *statusCommaIn(char **pS, struct status *ret)
 /* Create a status out of a comma separated string. 
  * This will fill in ret if non-null, otherwise will
  * return a new status */
 {
 char *s = *pS;
 
 if (ret == NULL)
     AllocVar(ret);
 ret->subjId = sqlStringComma(&s);
 ret->tnmRecurrenceTumorStatus = sqlStringComma(&s);
 ret->tnmRecurrenceMetastaticStatus = sqlStringComma(&s);
 ret->tnmClinicalTumorStatus = sqlStringComma(&s);
 ret->tnmRecurrenceLymphnodeStatus = sqlStringComma(&s);
 ret->tnmPathologyMetastaticStatus = sqlStringComma(&s);
 ret->tnmClinicalMetastaticStatus = sqlStringComma(&s);
 ret->tnmPathologyTumorStatus = sqlStringComma(&s);
 ret->tnmClinicalLymphnodeStatus = sqlStringComma(&s);
 ret->tnmPathologyLymphnodeStatus = sqlStringComma(&s);
 ret->progressionStatus = sqlStringComma(&s);
 ret->vitalStatus = sqlStringComma(&s);
 *pS = s;
 return ret;
 }
 
 void statusFree(struct status **pEl)
 /* Free a single dynamically allocated status such as created
  * with statusLoad(). */
 {
 struct status *el;
 
 if ((el = *pEl) == NULL) return;
 freeMem(el->subjId);
 freeMem(el->tnmRecurrenceTumorStatus);
 freeMem(el->tnmRecurrenceMetastaticStatus);
 freeMem(el->tnmClinicalTumorStatus);
 freeMem(el->tnmRecurrenceLymphnodeStatus);
 freeMem(el->tnmPathologyMetastaticStatus);
 freeMem(el->tnmClinicalMetastaticStatus);
 freeMem(el->tnmPathologyTumorStatus);
 freeMem(el->tnmClinicalLymphnodeStatus);
 freeMem(el->tnmPathologyLymphnodeStatus);
 freeMem(el->progressionStatus);
 freeMem(el->vitalStatus);
 freez(pEl);
 }
 
 void statusFreeList(struct status **pList)
 /* Free a list of dynamically allocated status's */
 {
 struct status *el, *next;
 
 for (el = *pList; el != NULL; el = next)
     {
     next = el->next;
     statusFree(&el);
     }
 *pList = NULL;
 }
 
 void statusOutput(struct status *el, FILE *f, char sep, char lastSep) 
 /* Print out status.  Separate fields with sep. Follow last field with lastSep. */
 {
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->subjId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmRecurrenceTumorStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmRecurrenceMetastaticStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmClinicalTumorStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmRecurrenceLymphnodeStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmPathologyMetastaticStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmClinicalMetastaticStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmPathologyTumorStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmClinicalLymphnodeStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmPathologyLymphnodeStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->progressionStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->vitalStatus);
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
 void treatmentStaticLoadWithNull(char **row, struct treatment *ret)
 /* Load a row from treatment table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->subjId = row[0];
 ret->startDate = row[1];
 ret->endDate = row[2];
 ret->dateOfRadiation = row[3];
 ret->dateOfProcedure = row[4];
 ret->initialCourse = row[5];
 ret->primaryProcedure = row[6];
 ret->drugCategory = row[7];
 ret->drugName = row[8];
 if (row[9] != NULL)
     {
     ret->drugDosage = needMem(sizeof(float));
     *(ret->drugDosage) = sqlFloat(row[9]);
     }
 ret->dosageUnits = row[10];
 ret->metastaticProcedure = row[11];
 ret->radiationType = row[12];
 if (row[13] != NULL)
     {
     ret->radiationDosage = needMem(sizeof(float));
     *(ret->radiationDosage) = sqlFloat(row[13]);
     }
 ret->lymphnodeProcedure = row[14];
 ret->anatomicTreatmentSite = row[15];
 }
 
 struct treatment *treatmentLoadWithNull(char **row)
 /* Load a treatment from row fetched with select * from treatment
  * from database.  Dispose of this with treatmentFree(). */
 {
 struct treatment *ret;
 
 AllocVar(ret);
 ret->subjId = cloneString(row[0]);
 ret->startDate = cloneString(row[1]);
 ret->endDate = cloneString(row[2]);
 ret->dateOfRadiation = cloneString(row[3]);
 ret->dateOfProcedure = cloneString(row[4]);
 ret->initialCourse = cloneString(row[5]);
 ret->primaryProcedure = cloneString(row[6]);
 ret->drugCategory = cloneString(row[7]);
 ret->drugName = cloneString(row[8]);
 if (row[9] != NULL)
     {
     ret->drugDosage = needMem(sizeof(float));
     *(ret->drugDosage) = sqlFloat(row[9]);
     }
 ret->dosageUnits = cloneString(row[10]);
 ret->metastaticProcedure = cloneString(row[11]);
 ret->radiationType = cloneString(row[12]);
 if (row[13] != NULL)
     {
     ret->radiationDosage = needMem(sizeof(float));
     *(ret->radiationDosage) = sqlFloat(row[13]);
     }
 ret->lymphnodeProcedure = cloneString(row[14]);
 ret->anatomicTreatmentSite = cloneString(row[15]);
 return ret;
 }
 
 struct treatment *treatmentLoadAll(char *fileName) 
 /* Load all treatment from a whitespace-separated file.
  * Dispose of this with treatmentFreeList(). */
 {
 struct treatment *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[16];
 
 while (lineFileRow(lf, row))
     {
     el = treatmentLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct treatment *treatmentLoadAllByChar(char *fileName, char chopper) 
 /* Load all treatment from a chopper separated file.
  * Dispose of this with treatmentFreeList(). */
 {
 struct treatment *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[16];
 
 while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
     {
     el = treatmentLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct treatment *treatmentLoadByQuery(struct sqlConnection *conn, char *query)
 /* Load all treatment 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 treatmentFreeList(). */
 {
 struct treatment *list = NULL, *el;
 struct sqlResult *sr;
 char **row;
 
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     el = treatmentLoadWithNull(row);
     slAddHead(&list, el);
     }
 slReverse(&list);
 sqlFreeResult(&sr);
 return list;
 }
 
 void treatmentSaveToDb(struct sqlConnection *conn, struct treatment *el, char *tableName, int updateSize)
 /* Save treatment 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 treatmentSaveToDbEscaped() */
 {
 struct dyString *update = newDyString(updateSize);
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s','%s','%s','%s',%g,'%s','%s','%s',%g,'%s','%s')", 
 	tableName,  el->subjId,  el->startDate,  el->endDate,  el->dateOfRadiation,  el->dateOfProcedure,  el->initialCourse,  el->primaryProcedure,  el->drugCategory,  el->drugName,  *(el->drugDosage),  el->dosageUnits,  el->metastaticProcedure,  el->radiationType,  *(el->radiationDosage),  el->lymphnodeProcedure,  el->anatomicTreatmentSite);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 }
 
 void treatmentSaveToDbEscaped(struct sqlConnection *conn, struct treatment *el, char *tableName, int updateSize)
 /* Save treatment 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 treatmentSaveToDb().
  * For example automatically copies and converts: 
  * "autosql's features include" --> "autosql\'s features include" 
  * before inserting into database. */ 
 {
 struct dyString *update = newDyString(updateSize);
 char  *subjId, *startDate, *endDate, *dateOfRadiation, *dateOfProcedure, *initialCourse, *primaryProcedure, *drugCategory, *drugName, *dosageUnits, *metastaticProcedure, *radiationType, *lymphnodeProcedure, *anatomicTreatmentSite;
 subjId = sqlEscapeString(el->subjId);
 startDate = sqlEscapeString(el->startDate);
 endDate = sqlEscapeString(el->endDate);
 dateOfRadiation = sqlEscapeString(el->dateOfRadiation);
 dateOfProcedure = sqlEscapeString(el->dateOfProcedure);
 initialCourse = sqlEscapeString(el->initialCourse);
 primaryProcedure = sqlEscapeString(el->primaryProcedure);
 drugCategory = sqlEscapeString(el->drugCategory);
 drugName = sqlEscapeString(el->drugName);
 dosageUnits = sqlEscapeString(el->dosageUnits);
 metastaticProcedure = sqlEscapeString(el->metastaticProcedure);
 radiationType = sqlEscapeString(el->radiationType);
 lymphnodeProcedure = sqlEscapeString(el->lymphnodeProcedure);
 anatomicTreatmentSite = sqlEscapeString(el->anatomicTreatmentSite);
 
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s','%s','%s','%s',%g,'%s','%s','%s',%g,'%s','%s')", 
 	tableName,  subjId,  startDate,  endDate,  dateOfRadiation,  dateOfProcedure,  initialCourse,  primaryProcedure,  drugCategory,  drugName,  *(el->drugDosage),  dosageUnits,  metastaticProcedure,  radiationType,  *(el->radiationDosage),  lymphnodeProcedure,  anatomicTreatmentSite);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&subjId);
 freez(&startDate);
 freez(&endDate);
 freez(&dateOfRadiation);
 freez(&dateOfProcedure);
 freez(&initialCourse);
 freez(&primaryProcedure);
 freez(&drugCategory);
 freez(&drugName);
 freez(&dosageUnits);
 freez(&metastaticProcedure);
 freez(&radiationType);
 freez(&lymphnodeProcedure);
 freez(&anatomicTreatmentSite);
 }
 
 struct treatment *treatmentCommaIn(char **pS, struct treatment *ret)
 /* Create a treatment out of a comma separated string. 
  * This will fill in ret if non-null, otherwise will
  * return a new treatment */
 {
 char *s = *pS;
 
 if (ret == NULL)
     AllocVar(ret);
 ret->subjId = sqlStringComma(&s);
 ret->startDate = sqlStringComma(&s);
 ret->endDate = sqlStringComma(&s);
 ret->dateOfRadiation = sqlStringComma(&s);
 ret->dateOfProcedure = sqlStringComma(&s);
 ret->initialCourse = sqlStringComma(&s);
 ret->primaryProcedure = sqlStringComma(&s);
 ret->drugCategory = sqlStringComma(&s);
 ret->drugName = sqlStringComma(&s);
 ret->drugDosage = needMem(sizeof(*(ret->drugDosage)));
 *(ret->drugDosage) = sqlFloatComma(&s);
 ret->dosageUnits = sqlStringComma(&s);
 ret->metastaticProcedure = sqlStringComma(&s);
 ret->radiationType = sqlStringComma(&s);
 ret->radiationDosage = needMem(sizeof(*(ret->radiationDosage)));
 *(ret->radiationDosage) = sqlFloatComma(&s);
 ret->lymphnodeProcedure = sqlStringComma(&s);
 ret->anatomicTreatmentSite = sqlStringComma(&s);
 *pS = s;
 return ret;
 }
 
 void treatmentFree(struct treatment **pEl)
 /* Free a single dynamically allocated treatment such as created
  * with treatmentLoad(). */
 {
 struct treatment *el;
 
 if ((el = *pEl) == NULL) return;
 freeMem(el->subjId);
 freeMem(el->startDate);
 freeMem(el->endDate);
 freeMem(el->dateOfRadiation);
 freeMem(el->dateOfProcedure);
 freeMem(el->initialCourse);
 freeMem(el->primaryProcedure);
 freeMem(el->drugCategory);
 freeMem(el->drugName);
 freeMem(el->dosageUnits);
 freeMem(el->metastaticProcedure);
 freeMem(el->radiationType);
 freeMem(el->lymphnodeProcedure);
 freeMem(el->anatomicTreatmentSite);
 freez(pEl);
 }
 
 void treatmentFreeList(struct treatment **pList)
 /* Free a list of dynamically allocated treatment's */
 {
 struct treatment *el, *next;
 
 for (el = *pList; el != NULL; el = next)
     {
     next = el->next;
     treatmentFree(&el);
     }
 *pList = NULL;
 }
 
 void treatmentOutput(struct treatment *el, FILE *f, char sep, char lastSep) 
 /* Print out treatment.  Separate fields with sep. Follow last field with lastSep. */
 {
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->subjId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->startDate);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->endDate);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->dateOfRadiation);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->dateOfProcedure);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->initialCourse);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->primaryProcedure);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->drugCategory);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->drugName);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%g", *(el->drugDosage));
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->dosageUnits);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->metastaticProcedure);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->radiationType);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%g", *(el->radiationDosage));
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->lymphnodeProcedure);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->anatomicTreatmentSite);
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
 void sampleInfoStaticLoadWithNull(char **row, struct sampleInfo *ret)
 /* Load a row from sampleInfo table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->subjId = row[0];
 ret->sampleId = row[1];
 ret->sampleType = row[2];
 ret->tumorSampleAnatomicLocation = row[3];
 ret->dateOfCollection = row[4];
 ret->timeBetweenClampingAndFreezing = row[5];
 ret->timeBetweenExcisionAndFreezing = row[6];
 ret->tumorTissueSite = row[7];
 ret->freezingMethod = row[8];
 ret->histologicalType = row[9];
 ret->verificationByBCR = row[10];
 ret->progressionDeterminedBy = row[11];
 ret->wellnNmber = row[12];
 ret->bcrSiteId = row[13];
 }
 
 struct sampleInfo *sampleInfoLoadWithNull(char **row)
 /* Load a sampleInfo from row fetched with select * from sampleInfo
  * from database.  Dispose of this with sampleInfoFree(). */
 {
 struct sampleInfo *ret;
 
 AllocVar(ret);
 ret->subjId = cloneString(row[0]);
 ret->sampleId = cloneString(row[1]);
 ret->sampleType = cloneString(row[2]);
 ret->tumorSampleAnatomicLocation = cloneString(row[3]);
 ret->dateOfCollection = cloneString(row[4]);
 ret->timeBetweenClampingAndFreezing = cloneString(row[5]);
 ret->timeBetweenExcisionAndFreezing = cloneString(row[6]);
 ret->tumorTissueSite = cloneString(row[7]);
 ret->freezingMethod = cloneString(row[8]);
 ret->histologicalType = cloneString(row[9]);
 ret->verificationByBCR = cloneString(row[10]);
 ret->progressionDeterminedBy = cloneString(row[11]);
 ret->wellnNmber = cloneString(row[12]);
 ret->bcrSiteId = cloneString(row[13]);
 return ret;
 }
 
 struct sampleInfo *sampleInfoLoadAll(char *fileName) 
 /* Load all sampleInfo from a whitespace-separated file.
  * Dispose of this with sampleInfoFreeList(). */
 {
 struct sampleInfo *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[14];
 
 while (lineFileRow(lf, row))
     {
     el = sampleInfoLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct sampleInfo *sampleInfoLoadAllByChar(char *fileName, char chopper) 
 /* Load all sampleInfo from a chopper separated file.
  * Dispose of this with sampleInfoFreeList(). */
 {
 struct sampleInfo *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[14];
 
 while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
     {
     el = sampleInfoLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct sampleInfo *sampleInfoLoadByQuery(struct sqlConnection *conn, char *query)
 /* Load all sampleInfo 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 sampleInfoFreeList(). */
 {
 struct sampleInfo *list = NULL, *el;
 struct sqlResult *sr;
 char **row;
 
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     el = sampleInfoLoadWithNull(row);
     slAddHead(&list, el);
     }
 slReverse(&list);
 sqlFreeResult(&sr);
 return list;
 }
 
 void sampleInfoSaveToDb(struct sqlConnection *conn, struct sampleInfo *el, char *tableName, int updateSize)
 /* Save sampleInfo 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 sampleInfoSaveToDbEscaped() */
 {
 struct dyString *update = newDyString(updateSize);
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", 
 	tableName,  el->subjId,  el->sampleId,  el->sampleType,  el->tumorSampleAnatomicLocation,  el->dateOfCollection,  el->timeBetweenClampingAndFreezing,  el->timeBetweenExcisionAndFreezing,  el->tumorTissueSite,  el->freezingMethod,  el->histologicalType,  el->verificationByBCR,  el->progressionDeterminedBy,  el->wellnNmber,  el->bcrSiteId);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 }
 
 void sampleInfoSaveToDbEscaped(struct sqlConnection *conn, struct sampleInfo *el, char *tableName, int updateSize)
 /* Save sampleInfo 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 sampleInfoSaveToDb().
  * For example automatically copies and converts: 
  * "autosql's features include" --> "autosql\'s features include" 
  * before inserting into database. */ 
 {
 struct dyString *update = newDyString(updateSize);
 char  *subjId, *sampleId, *sampleType, *tumorSampleAnatomicLocation, *dateOfCollection, *timeBetweenClampingAndFreezing, *timeBetweenExcisionAndFreezing, *tumorTissueSite, *freezingMethod, *histologicalType, *verificationByBCR, *progressionDeterminedBy, *wellnNmber, *bcrSiteId;
 subjId = sqlEscapeString(el->subjId);
 sampleId = sqlEscapeString(el->sampleId);
 sampleType = sqlEscapeString(el->sampleType);
 tumorSampleAnatomicLocation = sqlEscapeString(el->tumorSampleAnatomicLocation);
 dateOfCollection = sqlEscapeString(el->dateOfCollection);
 timeBetweenClampingAndFreezing = sqlEscapeString(el->timeBetweenClampingAndFreezing);
 timeBetweenExcisionAndFreezing = sqlEscapeString(el->timeBetweenExcisionAndFreezing);
 tumorTissueSite = sqlEscapeString(el->tumorTissueSite);
 freezingMethod = sqlEscapeString(el->freezingMethod);
 histologicalType = sqlEscapeString(el->histologicalType);
 verificationByBCR = sqlEscapeString(el->verificationByBCR);
 progressionDeterminedBy = sqlEscapeString(el->progressionDeterminedBy);
 wellnNmber = sqlEscapeString(el->wellnNmber);
 bcrSiteId = sqlEscapeString(el->bcrSiteId);
 
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", 
 	tableName,  subjId,  sampleId,  sampleType,  tumorSampleAnatomicLocation,  dateOfCollection,  timeBetweenClampingAndFreezing,  timeBetweenExcisionAndFreezing,  tumorTissueSite,  freezingMethod,  histologicalType,  verificationByBCR,  progressionDeterminedBy,  wellnNmber,  bcrSiteId);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&subjId);
 freez(&sampleId);
 freez(&sampleType);
 freez(&tumorSampleAnatomicLocation);
 freez(&dateOfCollection);
 freez(&timeBetweenClampingAndFreezing);
 freez(&timeBetweenExcisionAndFreezing);
 freez(&tumorTissueSite);
 freez(&freezingMethod);
 freez(&histologicalType);
 freez(&verificationByBCR);
 freez(&progressionDeterminedBy);
 freez(&wellnNmber);
 freez(&bcrSiteId);
 }
 
 struct sampleInfo *sampleInfoCommaIn(char **pS, struct sampleInfo *ret)
 /* Create a sampleInfo out of a comma separated string. 
  * This will fill in ret if non-null, otherwise will
  * return a new sampleInfo */
 {
 char *s = *pS;
 
 if (ret == NULL)
     AllocVar(ret);
 ret->subjId = sqlStringComma(&s);
 ret->sampleId = sqlStringComma(&s);
 ret->sampleType = sqlStringComma(&s);
 ret->tumorSampleAnatomicLocation = sqlStringComma(&s);
 ret->dateOfCollection = sqlStringComma(&s);
 ret->timeBetweenClampingAndFreezing = sqlStringComma(&s);
 ret->timeBetweenExcisionAndFreezing = sqlStringComma(&s);
 ret->tumorTissueSite = sqlStringComma(&s);
 ret->freezingMethod = sqlStringComma(&s);
 ret->histologicalType = sqlStringComma(&s);
 ret->verificationByBCR = sqlStringComma(&s);
 ret->progressionDeterminedBy = sqlStringComma(&s);
 ret->wellnNmber = sqlStringComma(&s);
 ret->bcrSiteId = sqlStringComma(&s);
 *pS = s;
 return ret;
 }
 
 void sampleInfoFree(struct sampleInfo **pEl)
 /* Free a single dynamically allocated sampleInfo such as created
  * with sampleInfoLoad(). */
 {
 struct sampleInfo *el;
 
 if ((el = *pEl) == NULL) return;
 freeMem(el->subjId);
 freeMem(el->sampleId);
 freeMem(el->sampleType);
 freeMem(el->tumorSampleAnatomicLocation);
 freeMem(el->dateOfCollection);
 freeMem(el->timeBetweenClampingAndFreezing);
 freeMem(el->timeBetweenExcisionAndFreezing);
 freeMem(el->tumorTissueSite);
 freeMem(el->freezingMethod);
 freeMem(el->histologicalType);
 freeMem(el->verificationByBCR);
 freeMem(el->progressionDeterminedBy);
 freeMem(el->wellnNmber);
 freeMem(el->bcrSiteId);
 freez(pEl);
 }
 
 void sampleInfoFreeList(struct sampleInfo **pList)
 /* Free a list of dynamically allocated sampleInfo's */
 {
 struct sampleInfo *el, *next;
 
 for (el = *pList; el != NULL; el = next)
     {
     next = el->next;
     sampleInfoFree(&el);
     }
 *pList = NULL;
 }
 
 void sampleInfoOutput(struct sampleInfo *el, FILE *f, char sep, char lastSep) 
 /* Print out sampleInfo.  Separate fields with sep. Follow last field with lastSep. */
 {
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->subjId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->sampleId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->sampleType);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tumorSampleAnatomicLocation);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->dateOfCollection);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->timeBetweenClampingAndFreezing);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->timeBetweenExcisionAndFreezing);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tumorTissueSite);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->freezingMethod);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->histologicalType);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->verificationByBCR);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->progressionDeterminedBy);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->wellnNmber);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->bcrSiteId);
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
 void resultStaticLoadWithNull(char **row, struct result *ret)
 /* Load a row from result table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->subjId = row[0];
 ret->sampleId = row[1];
 if (row[2] != NULL)
     {
     ret->a260a280Ratio = needMem(sizeof(float));
     *(ret->a260a280Ratio) = sqlFloat(row[2]);
     }
 if (row[3] != NULL)
     {
     ret->shortestDimension = needMem(sizeof(float));
     *(ret->shortestDimension) = sqlFloat(row[3]);
     }
 if (row[4] != NULL)
     {
     ret->longestDimension = needMem(sizeof(float));
     *(ret->longestDimension) = sqlFloat(row[4]);
     }
 ret->percentLymphocyteInfiltration = row[5];
 ret->ratio28s18s = row[6];
 ret->oligoDendroglialComponent = row[7];
 ret->numberRegionalLymphnodesPos = row[8];
 ret->tnmPathologyStageGrouping = row[9];
 if (row[10] != NULL)
     {
     ret->numFractions = needMem(sizeof(float));
     *(ret->numFractions) = sqlFloat(row[10]);
     }
 if (row[11] != NULL)
     {
     ret->numberCycles = needMem(sizeof(float));
     *(ret->numberCycles) = sqlFloat(row[11]);
     }
 ret->histologicNuclearGrade = row[12];
 ret->percentGranulocyteInfiltration = row[13];
 ret->marginsInvolved = row[14];
 ret->percentStromalCells = row[15];
 ret->numberProliferatingCells = row[16];
 ret->percentTumorNuclei = row[17];
 ret->histologicalNuclearGrade = row[18];
 ret->percentInflamInfiltration = row[19];
 ret->percentTumorCells = row[20];
 if (row[21] != NULL)
     {
     ret->concentration = needMem(sizeof(float));
     *(ret->concentration) = sqlFloat(row[21]);
     }
 ret->palisadingNecrosis = row[22];
 ret->percentNeutrophilInfiltration = row[23];
 ret->normalTumorGenotypeMatch = row[24];
 ret->tnmClinicalStageGrouping = row[25];
 ret->intermediateDimension = row[26];
 ret->leptomeningealInvolement = row[27];
 ret->gfap_positive = row[28];
 ret->percentEosinophilInfiltration = row[29];
 if (row[30] != NULL)
     {
     ret->karnofskyPerformanceScore = needMem(sizeof(float));
     *(ret->karnofskyPerformanceScore) = sqlFloat(row[30]);
     }
 ret->lymphaticInvasion = row[31];
 ret->percentNormalCells = row[32];
 ret->mib1_positive = row[33];
 ret->endothelialProliferation = row[34];
 ret->tnmRecurrenceStageGrouping = row[35];
 ret->gemistocytesPresent = row[36];
 ret->cellularity = row[37];
 ret->percentMonocyteInfiltration = row[38];
 ret->numberRegionalLymphnodesExam = row[39];
 ret->percentNecrosis = row[40];
 ret->rinValue = row[41];
 ret->nuclearPleomorphism = row[42];
 ret->venousInvasion = row[43];
 ret->octEmbedded = row[44];
 }
 
 struct result *resultLoadWithNull(char **row)
 /* Load a result from row fetched with select * from result
  * from database.  Dispose of this with resultFree(). */
 {
 struct result *ret;
 
 AllocVar(ret);
 ret->subjId = cloneString(row[0]);
 ret->sampleId = cloneString(row[1]);
 if (row[2] != NULL)
     {
     ret->a260a280Ratio = needMem(sizeof(float));
     *(ret->a260a280Ratio) = sqlFloat(row[2]);
     }
 if (row[3] != NULL)
     {
     ret->shortestDimension = needMem(sizeof(float));
     *(ret->shortestDimension) = sqlFloat(row[3]);
     }
 if (row[4] != NULL)
     {
     ret->longestDimension = needMem(sizeof(float));
     *(ret->longestDimension) = sqlFloat(row[4]);
     }
 ret->percentLymphocyteInfiltration = cloneString(row[5]);
 ret->ratio28s18s = cloneString(row[6]);
 ret->oligoDendroglialComponent = cloneString(row[7]);
 ret->numberRegionalLymphnodesPos = cloneString(row[8]);
 ret->tnmPathologyStageGrouping = cloneString(row[9]);
 if (row[10] != NULL)
     {
     ret->numFractions = needMem(sizeof(float));
     *(ret->numFractions) = sqlFloat(row[10]);
     }
 if (row[11] != NULL)
     {
     ret->numberCycles = needMem(sizeof(float));
     *(ret->numberCycles) = sqlFloat(row[11]);
     }
 ret->histologicNuclearGrade = cloneString(row[12]);
 ret->percentGranulocyteInfiltration = cloneString(row[13]);
 ret->marginsInvolved = cloneString(row[14]);
 ret->percentStromalCells = cloneString(row[15]);
 ret->numberProliferatingCells = cloneString(row[16]);
 ret->percentTumorNuclei = cloneString(row[17]);
 ret->histologicalNuclearGrade = cloneString(row[18]);
 ret->percentInflamInfiltration = cloneString(row[19]);
 ret->percentTumorCells = cloneString(row[20]);
 if (row[21] != NULL)
     {
     ret->concentration = needMem(sizeof(float));
     *(ret->concentration) = sqlFloat(row[21]);
     }
 ret->palisadingNecrosis = cloneString(row[22]);
 ret->percentNeutrophilInfiltration = cloneString(row[23]);
 ret->normalTumorGenotypeMatch = cloneString(row[24]);
 ret->tnmClinicalStageGrouping = cloneString(row[25]);
 ret->intermediateDimension = cloneString(row[26]);
 ret->leptomeningealInvolement = cloneString(row[27]);
 ret->gfap_positive = cloneString(row[28]);
 ret->percentEosinophilInfiltration = cloneString(row[29]);
 if (row[30] != NULL)
     {
     ret->karnofskyPerformanceScore = needMem(sizeof(float));
     *(ret->karnofskyPerformanceScore) = sqlFloat(row[30]);
     }
 ret->lymphaticInvasion = cloneString(row[31]);
 ret->percentNormalCells = cloneString(row[32]);
 ret->mib1_positive = cloneString(row[33]);
 ret->endothelialProliferation = cloneString(row[34]);
 ret->tnmRecurrenceStageGrouping = cloneString(row[35]);
 ret->gemistocytesPresent = cloneString(row[36]);
 ret->cellularity = cloneString(row[37]);
 ret->percentMonocyteInfiltration = cloneString(row[38]);
 ret->numberRegionalLymphnodesExam = cloneString(row[39]);
 ret->percentNecrosis = cloneString(row[40]);
 ret->rinValue = cloneString(row[41]);
 ret->nuclearPleomorphism = cloneString(row[42]);
 ret->venousInvasion = cloneString(row[43]);
 ret->octEmbedded = cloneString(row[44]);
 return ret;
 }
 
 struct result *resultLoadAll(char *fileName) 
 /* Load all result from a whitespace-separated file.
  * Dispose of this with resultFreeList(). */
 {
 struct result *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[45];
 
 while (lineFileRow(lf, row))
     {
     el = resultLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct result *resultLoadAllByChar(char *fileName, char chopper) 
 /* Load all result from a chopper separated file.
  * Dispose of this with resultFreeList(). */
 {
 struct result *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[45];
 
 while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
     {
     el = resultLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct result *resultLoadByQuery(struct sqlConnection *conn, char *query)
 /* Load all result 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 resultFreeList(). */
 {
 struct result *list = NULL, *el;
 struct sqlResult *sr;
 char **row;
 
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     el = resultLoadWithNull(row);
     slAddHead(&list, el);
     }
 slReverse(&list);
 sqlFreeResult(&sr);
 return list;
 }
 
 void resultSaveToDb(struct sqlConnection *conn, struct result *el, char *tableName, int updateSize)
 /* Save result 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 resultSaveToDbEscaped() */
 {
 struct dyString *update = newDyString(updateSize);
 dyStringPrintf(update, "insert into %s values ( '%s','%s',%g,%g,%g,'%s','%s','%s','%s','%s',%g,%g,'%s','%s','%s','%s','%s','%s','%s','%s','%s',%g,'%s','%s','%s','%s','%s','%s','%s','%s',%g,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", 
 	tableName,  el->subjId,  el->sampleId,  *(el->a260a280Ratio),  *(el->shortestDimension),  *(el->longestDimension),  el->percentLymphocyteInfiltration,  el->ratio28s18s,  el->oligoDendroglialComponent,  el->numberRegionalLymphnodesPos,  el->tnmPathologyStageGrouping,  *(el->numFractions),  *(el->numberCycles),  el->histologicNuclearGrade,  el->percentGranulocyteInfiltration,  el->marginsInvolved,  el->percentStromalCells,  el->numberProliferatingCells,  el->percentTumorNuclei,  el->histologicalNuclearGrade,  el->percentInflamInfiltration,  el->percentTumorCells,  *(el->concentration),  el->palisadingNecrosis,  el->percentNeutrophilInfiltration,  el->normalTumorGenotypeMatch,  el->tnmClinicalStageGrouping,  el->intermediateDimension,  el->leptomeningealInvolement,  el->gfap_positive,  el->percentEosinophilInfiltration,  *(el->karnofskyPerformanceScore),  el->lymphaticInvasion,  el->percentNormalCells,  el->mib1_positive,  el->endothelialProliferation,  el->tnmRecurrenceStageGrouping,  el->gemistocytesPresent,  el->cellularity,  el->percentMonocyteInfiltration,  el->numberRegionalLymphnodesExam,  el->percentNecrosis,  el->rinValue,  el->nuclearPleomorphism,  el->venousInvasion,  el->octEmbedded);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 }
 
 void resultSaveToDbEscaped(struct sqlConnection *conn, struct result *el, char *tableName, int updateSize)
 /* Save result 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 resultSaveToDb().
  * For example automatically copies and converts: 
  * "autosql's features include" --> "autosql\'s features include" 
  * before inserting into database. */ 
 {
 struct dyString *update = newDyString(updateSize);
 char  *subjId, *sampleId, *percentLymphocyteInfiltration, *ratio28s18s, *oligoDendroglialComponent, *numberRegionalLymphnodesPos, *tnmPathologyStageGrouping, *histologicNuclearGrade, *percentGranulocyteInfiltration, *marginsInvolved, *percentStromalCells, *numberProliferatingCells, *percentTumorNuclei, *histologicalNuclearGrade, *percentInflamInfiltration, *percentTumorCells, *palisadingNecrosis, *percentNeutrophilInfiltration, *normalTumorGenotypeMatch, *tnmClinicalStageGrouping, *intermediateDimension, *leptomeningealInvolement, *gfap_positive, *percentEosinophilInfiltration, *lymphaticInvasion, *percentNormalCells, *mib1_positive, *endothelialProliferation, *tnmRecurrenceStageGrouping, *gemistocytesPresent, *cellularity, *percentMonocyteInfiltration, *numberRegionalLymphnodesExam, *percentNecrosis, *rinValue, *nuclearPleomorphism, *venousInvasion, *octEmbedded;
 subjId = sqlEscapeString(el->subjId);
 sampleId = sqlEscapeString(el->sampleId);
 percentLymphocyteInfiltration = sqlEscapeString(el->percentLymphocyteInfiltration);
 ratio28s18s = sqlEscapeString(el->ratio28s18s);
 oligoDendroglialComponent = sqlEscapeString(el->oligoDendroglialComponent);
 numberRegionalLymphnodesPos = sqlEscapeString(el->numberRegionalLymphnodesPos);
 tnmPathologyStageGrouping = sqlEscapeString(el->tnmPathologyStageGrouping);
 histologicNuclearGrade = sqlEscapeString(el->histologicNuclearGrade);
 percentGranulocyteInfiltration = sqlEscapeString(el->percentGranulocyteInfiltration);
 marginsInvolved = sqlEscapeString(el->marginsInvolved);
 percentStromalCells = sqlEscapeString(el->percentStromalCells);
 numberProliferatingCells = sqlEscapeString(el->numberProliferatingCells);
 percentTumorNuclei = sqlEscapeString(el->percentTumorNuclei);
 histologicalNuclearGrade = sqlEscapeString(el->histologicalNuclearGrade);
 percentInflamInfiltration = sqlEscapeString(el->percentInflamInfiltration);
 percentTumorCells = sqlEscapeString(el->percentTumorCells);
 palisadingNecrosis = sqlEscapeString(el->palisadingNecrosis);
 percentNeutrophilInfiltration = sqlEscapeString(el->percentNeutrophilInfiltration);
 normalTumorGenotypeMatch = sqlEscapeString(el->normalTumorGenotypeMatch);
 tnmClinicalStageGrouping = sqlEscapeString(el->tnmClinicalStageGrouping);
 intermediateDimension = sqlEscapeString(el->intermediateDimension);
 leptomeningealInvolement = sqlEscapeString(el->leptomeningealInvolement);
 gfap_positive = sqlEscapeString(el->gfap_positive);
 percentEosinophilInfiltration = sqlEscapeString(el->percentEosinophilInfiltration);
 lymphaticInvasion = sqlEscapeString(el->lymphaticInvasion);
 percentNormalCells = sqlEscapeString(el->percentNormalCells);
 mib1_positive = sqlEscapeString(el->mib1_positive);
 endothelialProliferation = sqlEscapeString(el->endothelialProliferation);
 tnmRecurrenceStageGrouping = sqlEscapeString(el->tnmRecurrenceStageGrouping);
 gemistocytesPresent = sqlEscapeString(el->gemistocytesPresent);
 cellularity = sqlEscapeString(el->cellularity);
 percentMonocyteInfiltration = sqlEscapeString(el->percentMonocyteInfiltration);
 numberRegionalLymphnodesExam = sqlEscapeString(el->numberRegionalLymphnodesExam);
 percentNecrosis = sqlEscapeString(el->percentNecrosis);
 rinValue = sqlEscapeString(el->rinValue);
 nuclearPleomorphism = sqlEscapeString(el->nuclearPleomorphism);
 venousInvasion = sqlEscapeString(el->venousInvasion);
 octEmbedded = sqlEscapeString(el->octEmbedded);
 
 dyStringPrintf(update, "insert into %s values ( '%s','%s',%g,%g,%g,'%s','%s','%s','%s','%s',%g,%g,'%s','%s','%s','%s','%s','%s','%s','%s','%s',%g,'%s','%s','%s','%s','%s','%s','%s','%s',%g,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", 
 	tableName,  subjId,  sampleId,  *(el->a260a280Ratio),  *(el->shortestDimension),  *(el->longestDimension),  percentLymphocyteInfiltration,  ratio28s18s,  oligoDendroglialComponent,  numberRegionalLymphnodesPos,  tnmPathologyStageGrouping,  *(el->numFractions),  *(el->numberCycles),  histologicNuclearGrade,  percentGranulocyteInfiltration,  marginsInvolved,  percentStromalCells,  numberProliferatingCells,  percentTumorNuclei,  histologicalNuclearGrade,  percentInflamInfiltration,  percentTumorCells,  *(el->concentration),  palisadingNecrosis,  percentNeutrophilInfiltration,  normalTumorGenotypeMatch,  tnmClinicalStageGrouping,  intermediateDimension,  leptomeningealInvolement,  gfap_positive,  percentEosinophilInfiltration,  *(el->karnofskyPerformanceScore),  lymphaticInvasion,  percentNormalCells,  mib1_positive,  endothelialProliferation,  tnmRecurrenceStageGrouping,  gemistocytesPresent,  cellularity,  percentMonocyteInfiltration,  numberRegionalLymphnodesExam,  percentNecrosis,  rinValue,  nuclearPleomorphism,  venousInvasion,  octEmbedded);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&subjId);
 freez(&sampleId);
 freez(&percentLymphocyteInfiltration);
 freez(&ratio28s18s);
 freez(&oligoDendroglialComponent);
 freez(&numberRegionalLymphnodesPos);
 freez(&tnmPathologyStageGrouping);
 freez(&histologicNuclearGrade);
 freez(&percentGranulocyteInfiltration);
 freez(&marginsInvolved);
 freez(&percentStromalCells);
 freez(&numberProliferatingCells);
 freez(&percentTumorNuclei);
 freez(&histologicalNuclearGrade);
 freez(&percentInflamInfiltration);
 freez(&percentTumorCells);
 freez(&palisadingNecrosis);
 freez(&percentNeutrophilInfiltration);
 freez(&normalTumorGenotypeMatch);
 freez(&tnmClinicalStageGrouping);
 freez(&intermediateDimension);
 freez(&leptomeningealInvolement);
 freez(&gfap_positive);
 freez(&percentEosinophilInfiltration);
 freez(&lymphaticInvasion);
 freez(&percentNormalCells);
 freez(&mib1_positive);
 freez(&endothelialProliferation);
 freez(&tnmRecurrenceStageGrouping);
 freez(&gemistocytesPresent);
 freez(&cellularity);
 freez(&percentMonocyteInfiltration);
 freez(&numberRegionalLymphnodesExam);
 freez(&percentNecrosis);
 freez(&rinValue);
 freez(&nuclearPleomorphism);
 freez(&venousInvasion);
 freez(&octEmbedded);
 }
 
 struct result *resultCommaIn(char **pS, struct result *ret)
 /* Create a result out of a comma separated string. 
  * This will fill in ret if non-null, otherwise will
  * return a new result */
 {
 char *s = *pS;
 
 if (ret == NULL)
     AllocVar(ret);
 ret->subjId = sqlStringComma(&s);
 ret->sampleId = sqlStringComma(&s);
 ret->a260a280Ratio = needMem(sizeof(*(ret->a260a280Ratio)));
 *(ret->a260a280Ratio) = sqlFloatComma(&s);
 ret->shortestDimension = needMem(sizeof(*(ret->shortestDimension)));
 *(ret->shortestDimension) = sqlFloatComma(&s);
 ret->longestDimension = needMem(sizeof(*(ret->longestDimension)));
 *(ret->longestDimension) = sqlFloatComma(&s);
 ret->percentLymphocyteInfiltration = sqlStringComma(&s);
 ret->ratio28s18s = sqlStringComma(&s);
 ret->oligoDendroglialComponent = sqlStringComma(&s);
 ret->numberRegionalLymphnodesPos = sqlStringComma(&s);
 ret->tnmPathologyStageGrouping = sqlStringComma(&s);
 ret->numFractions = needMem(sizeof(*(ret->numFractions)));
 *(ret->numFractions) = sqlFloatComma(&s);
 ret->numberCycles = needMem(sizeof(*(ret->numberCycles)));
 *(ret->numberCycles) = sqlFloatComma(&s);
 ret->histologicNuclearGrade = sqlStringComma(&s);
 ret->percentGranulocyteInfiltration = sqlStringComma(&s);
 ret->marginsInvolved = sqlStringComma(&s);
 ret->percentStromalCells = sqlStringComma(&s);
 ret->numberProliferatingCells = sqlStringComma(&s);
 ret->percentTumorNuclei = sqlStringComma(&s);
 ret->histologicalNuclearGrade = sqlStringComma(&s);
 ret->percentInflamInfiltration = sqlStringComma(&s);
 ret->percentTumorCells = sqlStringComma(&s);
 ret->concentration = needMem(sizeof(*(ret->concentration)));
 *(ret->concentration) = sqlFloatComma(&s);
 ret->palisadingNecrosis = sqlStringComma(&s);
 ret->percentNeutrophilInfiltration = sqlStringComma(&s);
 ret->normalTumorGenotypeMatch = sqlStringComma(&s);
 ret->tnmClinicalStageGrouping = sqlStringComma(&s);
 ret->intermediateDimension = sqlStringComma(&s);
 ret->leptomeningealInvolement = sqlStringComma(&s);
 ret->gfap_positive = sqlStringComma(&s);
 ret->percentEosinophilInfiltration = sqlStringComma(&s);
 ret->karnofskyPerformanceScore = needMem(sizeof(*(ret->karnofskyPerformanceScore)));
 *(ret->karnofskyPerformanceScore) = sqlFloatComma(&s);
 ret->lymphaticInvasion = sqlStringComma(&s);
 ret->percentNormalCells = sqlStringComma(&s);
 ret->mib1_positive = sqlStringComma(&s);
 ret->endothelialProliferation = sqlStringComma(&s);
 ret->tnmRecurrenceStageGrouping = sqlStringComma(&s);
 ret->gemistocytesPresent = sqlStringComma(&s);
 ret->cellularity = sqlStringComma(&s);
 ret->percentMonocyteInfiltration = sqlStringComma(&s);
 ret->numberRegionalLymphnodesExam = sqlStringComma(&s);
 ret->percentNecrosis = sqlStringComma(&s);
 ret->rinValue = sqlStringComma(&s);
 ret->nuclearPleomorphism = sqlStringComma(&s);
 ret->venousInvasion = sqlStringComma(&s);
 ret->octEmbedded = sqlStringComma(&s);
 *pS = s;
 return ret;
 }
 
 void resultFree(struct result **pEl)
 /* Free a single dynamically allocated result such as created
  * with resultLoad(). */
 {
 struct result *el;
 
 if ((el = *pEl) == NULL) return;
 freeMem(el->subjId);
 freeMem(el->sampleId);
 freeMem(el->percentLymphocyteInfiltration);
 freeMem(el->ratio28s18s);
 freeMem(el->oligoDendroglialComponent);
 freeMem(el->numberRegionalLymphnodesPos);
 freeMem(el->tnmPathologyStageGrouping);
 freeMem(el->histologicNuclearGrade);
 freeMem(el->percentGranulocyteInfiltration);
 freeMem(el->marginsInvolved);
 freeMem(el->percentStromalCells);
 freeMem(el->numberProliferatingCells);
 freeMem(el->percentTumorNuclei);
 freeMem(el->histologicalNuclearGrade);
 freeMem(el->percentInflamInfiltration);
 freeMem(el->percentTumorCells);
 freeMem(el->palisadingNecrosis);
 freeMem(el->percentNeutrophilInfiltration);
 freeMem(el->normalTumorGenotypeMatch);
 freeMem(el->tnmClinicalStageGrouping);
 freeMem(el->intermediateDimension);
 freeMem(el->leptomeningealInvolement);
 freeMem(el->gfap_positive);
 freeMem(el->percentEosinophilInfiltration);
 freeMem(el->lymphaticInvasion);
 freeMem(el->percentNormalCells);
 freeMem(el->mib1_positive);
 freeMem(el->endothelialProliferation);
 freeMem(el->tnmRecurrenceStageGrouping);
 freeMem(el->gemistocytesPresent);
 freeMem(el->cellularity);
 freeMem(el->percentMonocyteInfiltration);
 freeMem(el->numberRegionalLymphnodesExam);
 freeMem(el->percentNecrosis);
 freeMem(el->rinValue);
 freeMem(el->nuclearPleomorphism);
 freeMem(el->venousInvasion);
 freeMem(el->octEmbedded);
 freez(pEl);
 }
 
 void resultFreeList(struct result **pList)
 /* Free a list of dynamically allocated result's */
 {
 struct result *el, *next;
 
 for (el = *pList; el != NULL; el = next)
     {
     next = el->next;
     resultFree(&el);
     }
 *pList = NULL;
 }
 
 void resultOutput(struct result *el, FILE *f, char sep, char lastSep) 
 /* Print out result.  Separate fields with sep. Follow last field with lastSep. */
 {
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->subjId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->sampleId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%g", *(el->a260a280Ratio));
 fputc(sep,f);
 fprintf(f, "%g", *(el->shortestDimension));
 fputc(sep,f);
 fprintf(f, "%g", *(el->longestDimension));
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentLymphocyteInfiltration);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->ratio28s18s);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->oligoDendroglialComponent);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->numberRegionalLymphnodesPos);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmPathologyStageGrouping);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%g", *(el->numFractions));
 fputc(sep,f);
 fprintf(f, "%g", *(el->numberCycles));
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->histologicNuclearGrade);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentGranulocyteInfiltration);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->marginsInvolved);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentStromalCells);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->numberProliferatingCells);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentTumorNuclei);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->histologicalNuclearGrade);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentInflamInfiltration);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentTumorCells);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%g", *(el->concentration));
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->palisadingNecrosis);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentNeutrophilInfiltration);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->normalTumorGenotypeMatch);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmClinicalStageGrouping);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->intermediateDimension);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->leptomeningealInvolement);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->gfap_positive);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentEosinophilInfiltration);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%g", *(el->karnofskyPerformanceScore));
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->lymphaticInvasion);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentNormalCells);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->mib1_positive);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->endothelialProliferation);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->tnmRecurrenceStageGrouping);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->gemistocytesPresent);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->cellularity);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentMonocyteInfiltration);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->numberRegionalLymphnodesExam);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->percentNecrosis);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->rinValue);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->nuclearPleomorphism);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->venousInvasion);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->octEmbedded);
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
 void miscStaticLoadWithNull(char **row, struct misc *ret)
 /* Load a row from misc table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->subjId = row[0];
 ret->sampleId = row[1];
 ret->revision = row[2];
 if (row[3] != NULL)
     {
     ret->amount = needMem(sizeof(float));
     *(ret->amount) = sqlFloat(row[3]);
     }
 if (row[4] != NULL)
     {
     ret->initialWeight = needMem(sizeof(float));
     *(ret->initialWeight) = sqlFloat(row[4]);
     }
 if (row[5] != NULL)
     {
     ret->currentWeight = needMem(sizeof(float));
     *(ret->currentWeight) = sqlFloat(row[5]);
     }
 ret->primaryOrMetastaticStatus = row[6];
 ret->protocolText = row[7];
 ret->protocolName = row[8];
 ret->protocolFileName = row[9];
 ret->analyteType = row[10];
 ret->sectionLocation = row[11];
 ret->pcrAmplificationSuccessful = row[12];
 if (row[13] != NULL)
     {
     ret->weight = needMem(sizeof(float));
     *(ret->weight) = sqlFloat(row[13]);
     }
 ret->experimentalProtocolType = row[14];
 ret->shippingDate = row[15];
 ret->gelImageFile = row[16];
 ret->histologicType = row[17];
 ret->dateCreated = row[18];
 ret->environmentalExposure = row[19];
 ret->cancerStatus = row[20];
 }
 
 struct misc *miscLoadWithNull(char **row)
 /* Load a misc from row fetched with select * from misc
  * from database.  Dispose of this with miscFree(). */
 {
 struct misc *ret;
 
 AllocVar(ret);
 ret->subjId = cloneString(row[0]);
 ret->sampleId = cloneString(row[1]);
 ret->revision = cloneString(row[2]);
 if (row[3] != NULL)
     {
     ret->amount = needMem(sizeof(float));
     *(ret->amount) = sqlFloat(row[3]);
     }
 if (row[4] != NULL)
     {
     ret->initialWeight = needMem(sizeof(float));
     *(ret->initialWeight) = sqlFloat(row[4]);
     }
 if (row[5] != NULL)
     {
     ret->currentWeight = needMem(sizeof(float));
     *(ret->currentWeight) = sqlFloat(row[5]);
     }
 ret->primaryOrMetastaticStatus = cloneString(row[6]);
 ret->protocolText = cloneString(row[7]);
 ret->protocolName = cloneString(row[8]);
 ret->protocolFileName = cloneString(row[9]);
 ret->analyteType = cloneString(row[10]);
 ret->sectionLocation = cloneString(row[11]);
 ret->pcrAmplificationSuccessful = cloneString(row[12]);
 if (row[13] != NULL)
     {
     ret->weight = needMem(sizeof(float));
     *(ret->weight) = sqlFloat(row[13]);
     }
 ret->experimentalProtocolType = cloneString(row[14]);
 ret->shippingDate = cloneString(row[15]);
 ret->gelImageFile = cloneString(row[16]);
 ret->histologicType = cloneString(row[17]);
 ret->dateCreated = cloneString(row[18]);
 ret->environmentalExposure = cloneString(row[19]);
 ret->cancerStatus = cloneString(row[20]);
 return ret;
 }
 
 struct misc *miscLoadAll(char *fileName) 
 /* Load all misc from a whitespace-separated file.
  * Dispose of this with miscFreeList(). */
 {
 struct misc *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[21];
 
 while (lineFileRow(lf, row))
     {
     el = miscLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct misc *miscLoadAllByChar(char *fileName, char chopper) 
 /* Load all misc from a chopper separated file.
  * Dispose of this with miscFreeList(). */
 {
 struct misc *list = NULL, *el;
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[21];
 
 while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
     {
     el = miscLoadWithNull(row);
     slAddHead(&list, el);
     }
 lineFileClose(&lf);
 slReverse(&list);
 return list;
 }
 
 struct misc *miscLoadByQuery(struct sqlConnection *conn, char *query)
 /* Load all misc 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 miscFreeList(). */
 {
 struct misc *list = NULL, *el;
 struct sqlResult *sr;
 char **row;
 
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     el = miscLoadWithNull(row);
     slAddHead(&list, el);
     }
 slReverse(&list);
 sqlFreeResult(&sr);
 return list;
 }
 
 void miscSaveToDb(struct sqlConnection *conn, struct misc *el, char *tableName, int updateSize)
 /* Save misc 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 miscSaveToDbEscaped() */
 {
 struct dyString *update = newDyString(updateSize);
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s',%g,%g,%g,'%s','%s','%s','%s','%s','%s','%s',%g,'%s','%s','%s','%s','%s','%s','%s')", 
 	tableName,  el->subjId,  el->sampleId,  el->revision,  *(el->amount),  *(el->initialWeight),  *(el->currentWeight),  el->primaryOrMetastaticStatus,  el->protocolText,  el->protocolName,  el->protocolFileName,  el->analyteType,  el->sectionLocation,  el->pcrAmplificationSuccessful,  *(el->weight),  el->experimentalProtocolType,  el->shippingDate,  el->gelImageFile,  el->histologicType,  el->dateCreated,  el->environmentalExposure,  el->cancerStatus);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 }
 
 void miscSaveToDbEscaped(struct sqlConnection *conn, struct misc *el, char *tableName, int updateSize)
 /* Save misc 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 miscSaveToDb().
  * For example automatically copies and converts: 
  * "autosql's features include" --> "autosql\'s features include" 
  * before inserting into database. */ 
 {
 struct dyString *update = newDyString(updateSize);
 char  *subjId, *sampleId, *revision, *primaryOrMetastaticStatus, *protocolText, *protocolName, *protocolFileName, *analyteType, *sectionLocation, *pcrAmplificationSuccessful, *experimentalProtocolType, *shippingDate, *gelImageFile, *histologicType, *dateCreated, *environmentalExposure, *cancerStatus;
 subjId = sqlEscapeString(el->subjId);
 sampleId = sqlEscapeString(el->sampleId);
 revision = sqlEscapeString(el->revision);
 primaryOrMetastaticStatus = sqlEscapeString(el->primaryOrMetastaticStatus);
 protocolText = sqlEscapeString(el->protocolText);
 protocolName = sqlEscapeString(el->protocolName);
 protocolFileName = sqlEscapeString(el->protocolFileName);
 analyteType = sqlEscapeString(el->analyteType);
 sectionLocation = sqlEscapeString(el->sectionLocation);
 pcrAmplificationSuccessful = sqlEscapeString(el->pcrAmplificationSuccessful);
 experimentalProtocolType = sqlEscapeString(el->experimentalProtocolType);
 shippingDate = sqlEscapeString(el->shippingDate);
 gelImageFile = sqlEscapeString(el->gelImageFile);
 histologicType = sqlEscapeString(el->histologicType);
 dateCreated = sqlEscapeString(el->dateCreated);
 environmentalExposure = sqlEscapeString(el->environmentalExposure);
 cancerStatus = sqlEscapeString(el->cancerStatus);
 
 dyStringPrintf(update, "insert into %s values ( '%s','%s','%s',%g,%g,%g,'%s','%s','%s','%s','%s','%s','%s',%g,'%s','%s','%s','%s','%s','%s','%s')", 
 	tableName,  subjId,  sampleId,  revision,  *(el->amount),  *(el->initialWeight),  *(el->currentWeight),  primaryOrMetastaticStatus,  protocolText,  protocolName,  protocolFileName,  analyteType,  sectionLocation,  pcrAmplificationSuccessful,  *(el->weight),  experimentalProtocolType,  shippingDate,  gelImageFile,  histologicType,  dateCreated,  environmentalExposure,  cancerStatus);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&subjId);
 freez(&sampleId);
 freez(&revision);
 freez(&primaryOrMetastaticStatus);
 freez(&protocolText);
 freez(&protocolName);
 freez(&protocolFileName);
 freez(&analyteType);
 freez(&sectionLocation);
 freez(&pcrAmplificationSuccessful);
 freez(&experimentalProtocolType);
 freez(&shippingDate);
 freez(&gelImageFile);
 freez(&histologicType);
 freez(&dateCreated);
 freez(&environmentalExposure);
 freez(&cancerStatus);
 }
 
 struct misc *miscCommaIn(char **pS, struct misc *ret)
 /* Create a misc out of a comma separated string. 
  * This will fill in ret if non-null, otherwise will
  * return a new misc */
 {
 char *s = *pS;
 
 if (ret == NULL)
     AllocVar(ret);
 ret->subjId = sqlStringComma(&s);
 ret->sampleId = sqlStringComma(&s);
 ret->revision = sqlStringComma(&s);
 ret->amount = needMem(sizeof(*(ret->amount)));
 *(ret->amount) = sqlFloatComma(&s);
 ret->initialWeight = needMem(sizeof(*(ret->initialWeight)));
 *(ret->initialWeight) = sqlFloatComma(&s);
 ret->currentWeight = needMem(sizeof(*(ret->currentWeight)));
 *(ret->currentWeight) = sqlFloatComma(&s);
 ret->primaryOrMetastaticStatus = sqlStringComma(&s);
 ret->protocolText = sqlStringComma(&s);
 ret->protocolName = sqlStringComma(&s);
 ret->protocolFileName = sqlStringComma(&s);
 ret->analyteType = sqlStringComma(&s);
 ret->sectionLocation = sqlStringComma(&s);
 ret->pcrAmplificationSuccessful = sqlStringComma(&s);
 ret->weight = needMem(sizeof(*(ret->weight)));
 *(ret->weight) = sqlFloatComma(&s);
 ret->experimentalProtocolType = sqlStringComma(&s);
 ret->shippingDate = sqlStringComma(&s);
 ret->gelImageFile = sqlStringComma(&s);
 ret->histologicType = sqlStringComma(&s);
 ret->dateCreated = sqlStringComma(&s);
 ret->environmentalExposure = sqlStringComma(&s);
 ret->cancerStatus = sqlStringComma(&s);
 *pS = s;
 return ret;
 }
 
 void miscFree(struct misc **pEl)
 /* Free a single dynamically allocated misc such as created
  * with miscLoad(). */
 {
 struct misc *el;
 
 if ((el = *pEl) == NULL) return;
 freeMem(el->subjId);
 freeMem(el->sampleId);
 freeMem(el->revision);
 freeMem(el->primaryOrMetastaticStatus);
 freeMem(el->protocolText);
 freeMem(el->protocolName);
 freeMem(el->protocolFileName);
 freeMem(el->analyteType);
 freeMem(el->sectionLocation);
 freeMem(el->pcrAmplificationSuccessful);
 freeMem(el->experimentalProtocolType);
 freeMem(el->shippingDate);
 freeMem(el->gelImageFile);
 freeMem(el->histologicType);
 freeMem(el->dateCreated);
 freeMem(el->environmentalExposure);
 freeMem(el->cancerStatus);
 freez(pEl);
 }
 
 void miscFreeList(struct misc **pList)
 /* Free a list of dynamically allocated misc's */
 {
 struct misc *el, *next;
 
 for (el = *pList; el != NULL; el = next)
     {
     next = el->next;
     miscFree(&el);
     }
 *pList = NULL;
 }
 
 void miscOutput(struct misc *el, FILE *f, char sep, char lastSep) 
 /* Print out misc.  Separate fields with sep. Follow last field with lastSep. */
 {
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->subjId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->sampleId);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->revision);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%g", *(el->amount));
 fputc(sep,f);
 fprintf(f, "%g", *(el->initialWeight));
 fputc(sep,f);
 fprintf(f, "%g", *(el->currentWeight));
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->primaryOrMetastaticStatus);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->protocolText);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->protocolName);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->protocolFileName);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->analyteType);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->sectionLocation);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->pcrAmplificationSuccessful);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 fprintf(f, "%g", *(el->weight));
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->experimentalProtocolType);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->shippingDate);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->gelImageFile);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->histologicType);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->dateCreated);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->environmentalExposure);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->cancerStatus);
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
 /* -------------------------------- End autoSql Generated Code -------------------------------- */