4ba0a7d92cc93673915bb6f24ae81435ea179ce3 hiram Wed Jan 31 17:02:58 2024 -0800 beginning to add a searchable table of genome meta data refs #23589; diff --git src/hg/inc/genomeData.h src/hg/inc/genomeData.h new file mode 100644 index 0000000..a6fbcaa --- /dev/null +++ src/hg/inc/genomeData.h @@ -0,0 +1,117 @@ +/* genomeData.h was originally generated by the autoSql program, which also + * generated genomeData.c and genomeData.sql. This header links the database and + * the RAM representation of objects. */ + +#ifndef GENOMEDATA_H +#define GENOMEDATA_H + +#include "jksql.h" +#define GENOMEDATA_NUM_COLS 37 + +extern char *genomeDataCommaSepFieldNames; + +struct genomeData +/* SQL table for NCBI assembly_summary data. */ + { + struct genomeData *next; /* Next in singly linked list. */ + char *assemblyAccession; /* assemblyAccession */ + char *bioproject; /* bioproject */ + char *biosample; /* biosample */ + char *wgsMaster; /* wgsMaster */ + char *refseqCategory; /* refseqCategory */ + unsigned *taxId; /* taxId */ + unsigned *speciesTaxid; /* speciesTaxid */ + char *organismName; /* organismName */ + char *infraspecificName; /* infraspecificName */ + char *isolate; /* isolate */ + char *versionStatus; /* versionStatus */ + char *assemblyLevel; /* assemblyLevel */ + char *releaseType; /* releaseType */ + char *genomeRep; /* genomeRep */ + char *seqRelDate; /* seqRelDate */ + char *asmName; /* asmName */ + char *asmSubmitter; /* asmSubmitter */ + char *gbrsPairedAsm; /* gbrsPairedAsm */ + char *pairedAsmComp; /* pairedAsmComp */ + char *ftpPath; /* ftpPath */ + char *excludedFromRefseq; /* excludedFromRefseq */ + char *relationToTypeMaterial; /* relationToTypeMaterial */ + unsigned char *assemblyType; /* assemblyType */ + char *phyloGroup; /* phyloGroup */ + long long *genomeSize; /* genomeSize */ + long long *genomeSizeUngapped; /* genomeSizeUngapped */ + float *gcPercent; /* gcPercent */ + unsigned short *repliconCount; /* repliconCount */ + unsigned *scaffoldCount; /* scaffoldCount */ + unsigned *contigCount; /* contigCount */ + char *annotationProvider; /* annotationProvider */ + char *annotationName; /* annotationName */ + char *annotationDate; /* annotationDate */ + char *totalGeneCount; /* totalGeneCount */ + unsigned *proteinCodingGeneCount; /* proteinCodingGeneCount */ + char *nonCodingGeneCount; /* nonCodingGeneCount */ + char *pubmedId; /* pubmedId */ + }; + +void genomeDataStaticLoadWithNull(char **row, struct genomeData *ret); +/* Load a row from genomeData table into ret. The contents of ret will + * be replaced at the next call to this function. */ + +struct genomeData *genomeDataLoadByQuery(struct sqlConnection *conn, char *query); +/* Load all genomeData 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 genomeDataFreeList(). */ + +void genomeDataSaveToDb(struct sqlConnection *conn, struct genomeData *el, char *tableName, int updateSize); +/* Save genomeData 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 genomeData *genomeDataLoadWithNull(char **row); +/* Load a genomeData from row fetched with select * from genomeData + * from database. Dispose of this with genomeDataFree(). */ + +struct genomeData *genomeDataLoadAll(char *fileName); +/* Load all genomeData from whitespace-separated file. + * Dispose of this with genomeDataFreeList(). */ + +struct genomeData *genomeDataLoadAllByChar(char *fileName, char chopper); +/* Load all genomeData from chopper separated file. + * Dispose of this with genomeDataFreeList(). */ + +#define genomeDataLoadAllByTab(a) genomeDataLoadAllByChar(a, '\t'); +/* Load all genomeData from tab separated file. + * Dispose of this with genomeDataFreeList(). */ + +struct genomeData *genomeDataCommaIn(char **pS, struct genomeData *ret); +/* Create a genomeData out of a comma separated string. + * This will fill in ret if non-null, otherwise will + * return a new genomeData */ + +void genomeDataFree(struct genomeData **pEl); +/* Free a single dynamically allocated genomeData such as created + * with genomeDataLoad(). */ + +void genomeDataFreeList(struct genomeData **pList); +/* Free a list of dynamically allocated genomeData's */ + +void genomeDataOutput(struct genomeData *el, FILE *f, char sep, char lastSep); +/* Print out genomeData. Separate fields with sep. Follow last field with lastSep. */ + +#define genomeDataTabOut(el,f) genomeDataOutput(el,f,'\t','\n'); +/* Print out genomeData as a line in a tab-separated file. */ + +#define genomeDataCommaOut(el,f) genomeDataOutput(el,f,',',','); +/* Print out genomeData as a comma separated list including final comma. */ + +void genomeDataJsonOutput(struct genomeData *el, FILE *f); +/* Print out genomeData in JSON format. */ + +/* -------------------------------- End autoSql Generated Code -------------------------------- */ + +#endif /* GENOMEDATA_H */ +