6afca455c54a8978418619a55933beb76897e09c hiram Wed Jun 26 14:59:55 2024 -0700 code to work with genomePriority.hgcentral table refs #32897 diff --git src/hg/lib/genomePriority.h src/hg/lib/genomePriority.h new file mode 100644 index 0000000..c87e74d --- /dev/null +++ src/hg/lib/genomePriority.h @@ -0,0 +1,86 @@ +/* genomePriority.h was originally generated by the autoSql program, which also + * generated genomePriority.c and genomePriority.sql. This header links the database and + * the RAM representation of objects. */ + +#ifndef GENOMEPRIORITY_H +#define GENOMEPRIORITY_H + +#include "jksql.h" +#define GENOMEPRIORITY_NUM_COLS 6 + +extern char *genomePriorityCommaSepFieldNames; + +struct genomePriority +/* listing all UCSC genomes, dbDb or GenArk, with search priority */ + { + struct genomePriority *next; /* Next in singly linked list. */ + char *name; /* UCSC genome: dbDb name or GenArk accession */ + unsigned priority; /* assigned search priority */ + char *commonName; /* a common name */ + char *scientificName; /* binomial scientific name */ + unsigned taxId; /* Entrez taxon ID: www.ncbi.nlm.nih.gov/taxonomy/?term=xxx */ + char *description; /* other description text */ + }; + +void genomePriorityStaticLoad(char **row, struct genomePriority *ret); +/* Load a row from genomePriority table into ret. The contents of ret will + * be replaced at the next call to this function. */ + +struct genomePriority *genomePriorityLoadByQuery(struct sqlConnection *conn, char *query); +/* Load all genomePriority 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 genomePriorityFreeList(). */ + +void genomePrioritySaveToDb(struct sqlConnection *conn, struct genomePriority *el, char *tableName, int updateSize); +/* Save genomePriority 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. This function automatically escapes quoted strings for mysql. */ + +struct genomePriority *genomePriorityLoad(char **row); +/* Load a genomePriority from row fetched with select * from genomePriority + * from database. Dispose of this with genomePriorityFree(). */ + +struct genomePriority *genomePriorityLoadAll(char *fileName); +/* Load all genomePriority from whitespace-separated file. + * Dispose of this with genomePriorityFreeList(). */ + +struct genomePriority *genomePriorityLoadAllByChar(char *fileName, char chopper); +/* Load all genomePriority from chopper separated file. + * Dispose of this with genomePriorityFreeList(). */ + +#define genomePriorityLoadAllByTab(a) genomePriorityLoadAllByChar(a, '\t'); +/* Load all genomePriority from tab separated file. + * Dispose of this with genomePriorityFreeList(). */ + +struct genomePriority *genomePriorityCommaIn(char **pS, struct genomePriority *ret); +/* Create a genomePriority out of a comma separated string. + * This will fill in ret if non-null, otherwise will + * return a new genomePriority */ + +void genomePriorityFree(struct genomePriority **pEl); +/* Free a single dynamically allocated genomePriority such as created + * with genomePriorityLoad(). */ + +void genomePriorityFreeList(struct genomePriority **pList); +/* Free a list of dynamically allocated genomePriority's */ + +void genomePriorityOutput(struct genomePriority *el, FILE *f, char sep, char lastSep); +/* Print out genomePriority. Separate fields with sep. Follow last field with lastSep. */ + +#define genomePriorityTabOut(el,f) genomePriorityOutput(el,f,'\t','\n'); +/* Print out genomePriority as a line in a tab-separated file. */ + +#define genomePriorityCommaOut(el,f) genomePriorityOutput(el,f,',',','); +/* Print out genomePriority as a comma separated list including final comma. */ + +void genomePriorityJsonOutput(struct genomePriority *el, FILE *f); +/* Print out genomePriority in JSON format. */ + +/* -------------------------------- End autoSql Generated Code -------------------------------- */ + +#endif /* GENOMEPRIORITY_H */ +