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

/* Copyright (C) 2013 The Regents of the University of California 
 * See README in this or parent directory for licensing information. */

#ifndef GENOTYPEFREQS_H
#define GENOTYPEFREQS_H

#ifndef JKSQL_H
#include "jksql.h"
#endif

#define GENOTYPEFREQS_NUM_COLS 20

struct genotypeFreqs
/* Genotype Frequencies from HapMap */
    {
    struct genotypeFreqs *next;  /* Next in singly linked list. */
    char *rsId;	/* rs		rs2104604 */
    char *chrom;	/* chrom		Chr1 */
    int chromStart;	/* pos		101809619 */
    char strand;	/* strand		+ */
    char *assembly;	/* build		ncbi_34 */
    char *center;	/* center		bcm */
    char *protLSID;	/* protLSID */
    char *assayLSID;	/* assayLSID */
    char *panelLSID;	/* panelLSID */
    char *majGt;	/* majorhom-gt	G/G */
    float majFreq;	/* majorhom-freq	1 */
    int majCount;	/* majorhom-count	60 */
    char *hetGt;	/* het-gt		G/T */
    float hetFreq;	/* het-freq	0 */
    int hetCount;	/* het-count	0 */
    char *minGt;	/* minorhom-gt	T/T */
    float minFreq;	/* minorhom-freq	0 */
    int minCount;	/* minorhom-count	0 */
    int totCount;	/* totalcount	60 */
    float minAlFreq;	/* maf		0 */
    };

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

struct genotypeFreqs *genotypeFreqsLoad(char **row);
/* Load a genotypeFreqs from row fetched with select * from genotypeFreqs
 * from database.  Dispose of this with genotypeFreqsFree(). */

struct genotypeFreqs *genotypeFreqsLoadAll(char *fileName);
/* Load all genotypeFreqs from whitespace-separated file.
 * Dispose of this with genotypeFreqsFreeList(). */

struct genotypeFreqs *genotypeFreqsLoadAllByChar(char *fileName, char chopper);
/* Load all genotypeFreqs from chopper separated file.
 * Dispose of this with genotypeFreqsFreeList(). */

#define genotypeFreqsLoadAllByTab(a) genotypeFreqsLoadAllByChar(a, '\t');
/* Load all genotypeFreqs from tab separated file.
 * Dispose of this with genotypeFreqsFreeList(). */

struct genotypeFreqs *genotypeFreqsLoadByQuery(struct sqlConnection *conn, char *query);
/* Load all genotypeFreqs 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 genotypeFreqsFreeList(). */

void genotypeFreqsSaveToDb(struct sqlConnection *conn, struct genotypeFreqs *el, char *tableName, int updateSize);
/* Save genotypeFreqs 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. Strings are automatically escaped to allow insertion into the database. */

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

void genotypeFreqsFree(struct genotypeFreqs **pEl);
/* Free a single dynamically allocated genotypeFreqs such as created
 * with genotypeFreqsLoad(). */

void genotypeFreqsFreeList(struct genotypeFreqs **pList);
/* Free a list of dynamically allocated genotypeFreqs's */

void genotypeFreqsOutput(struct genotypeFreqs *el, FILE *f, char sep, char lastSep);
/* Print out genotypeFreqs.  Separate fields with sep. Follow last field with lastSep. */

#define genotypeFreqsTabOut(el,f) genotypeFreqsOutput(el,f,'\t','\n');
/* Print out genotypeFreqs as a line in a tab-separated file. */

#define genotypeFreqsCommaOut(el,f) genotypeFreqsOutput(el,f,',',',');
/* Print out genotypeFreqs as a comma separated list including final comma. */

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

#endif /* GENOTYPEFREQS_H */

