/* lowelabArkinOperonScore.c was originally generated by the autoSql program, which also 
 * generated lowelabArkinOperonScore.h and lowelabArkinOperonScore.sql.  This module links the database and
 * the RAM representation of objects. */

/* Copyright (C) 2014 The Regents of the University of California 
 * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */

#include "common.h"
#include "linefile.h"
#include "dystring.h"
#include "jksql.h"
#include "lowelabArkinOperonScore.h"


void lowelabArkinOperonScoreStaticLoad(char **row, struct lowelabArkinOperonScore *ret)
/* Load a row from lowelabArkinOperonScore table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->name = row[0];
ret->gene1 = row[1];
ret->gene2 = row[2];
ret->prob = sqlFloat(row[3]);
ret->gnMinus = sqlFloat(row[4]);
}

struct lowelabArkinOperonScore *lowelabArkinOperonScoreLoad(char **row)
/* Load a lowelabArkinOperonScore from row fetched with select * from lowelabArkinOperonScore
 * from database.  Dispose of this with lowelabArkinOperonScoreFree(). */
{
struct lowelabArkinOperonScore *ret;

AllocVar(ret);
ret->name = cloneString(row[0]);
ret->gene1 = cloneString(row[1]);
ret->gene2 = cloneString(row[2]);
ret->prob = sqlFloat(row[3]);
ret->gnMinus = sqlFloat(row[4]);
return ret;
}

struct lowelabArkinOperonScore *lowelabArkinOperonScoreLoadAll(char *fileName) 
/* Load all lowelabArkinOperonScore from a whitespace-separated file.
 * Dispose of this with lowelabArkinOperonScoreFreeList(). */
{
struct lowelabArkinOperonScore *list = NULL, *el;
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[5];

while (lineFileRow(lf, row))
    {
    el = lowelabArkinOperonScoreLoad(row);
    slAddHead(&list, el);
    }
lineFileClose(&lf);
slReverse(&list);
return list;
}

struct lowelabArkinOperonScore *lowelabArkinOperonScoreLoadAllByChar(char *fileName, char chopper) 
/* Load all lowelabArkinOperonScore from a chopper separated file.
 * Dispose of this with lowelabArkinOperonScoreFreeList(). */
{
struct lowelabArkinOperonScore *list = NULL, *el;
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[5];

while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
    {
    el = lowelabArkinOperonScoreLoad(row);
    slAddHead(&list, el);
    }
lineFileClose(&lf);
slReverse(&list);
return list;
}

struct lowelabArkinOperonScore *lowelabArkinOperonScoreCommaIn(char **pS, struct lowelabArkinOperonScore *ret)
/* Create a lowelabArkinOperonScore out of a comma separated string. 
 * This will fill in ret if non-null, otherwise will
 * return a new lowelabArkinOperonScore */
{
char *s = *pS;

if (ret == NULL)
    AllocVar(ret);
ret->name = sqlStringComma(&s);
ret->gene1 = sqlStringComma(&s);
ret->gene2 = sqlStringComma(&s);
ret->prob = sqlFloatComma(&s);
ret->gnMinus = sqlFloatComma(&s);
*pS = s;
return ret;
}

void lowelabArkinOperonScoreFree(struct lowelabArkinOperonScore **pEl)
/* Free a single dynamically allocated lowelabArkinOperonScore such as created
 * with lowelabArkinOperonScoreLoad(). */
{
struct lowelabArkinOperonScore *el;

if ((el = *pEl) == NULL) return;
freeMem(el->name);
freeMem(el->gene1);
freeMem(el->gene2);
freez(pEl);
}

void lowelabArkinOperonScoreFreeList(struct lowelabArkinOperonScore **pList)
/* Free a list of dynamically allocated lowelabArkinOperonScore's */
{
struct lowelabArkinOperonScore *el, *next;

for (el = *pList; el != NULL; el = next)
    {
    next = el->next;
    lowelabArkinOperonScoreFree(&el);
    }
*pList = NULL;
}

void lowelabArkinOperonScoreOutput(struct lowelabArkinOperonScore *el, FILE *f, char sep, char lastSep) 
/* Print out lowelabArkinOperonScore.  Separate fields with sep. Follow last field with lastSep. */
{
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->name);
if (sep == ',') fputc('"',f);
fputc(sep,f);
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->gene1);
if (sep == ',') fputc('"',f);
fputc(sep,f);
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->gene2);
if (sep == ',') fputc('"',f);
fputc(sep,f);
fprintf(f, "%g", el->prob);
fputc(sep,f);
fprintf(f, "%g", el->gnMinus);
fputc(lastSep,f);
}

/* -------------------------------- End autoSql Generated Code -------------------------------- */

