643fc5346b9416e784bdf9b169ae9405d651264d hiram Thu Jul 30 15:37:45 2026 -0700 definitions to load the assembly_summary files from NCBI refs #37958 diff --git src/hg/inc/assemblySummary.h src/hg/inc/assemblySummary.h new file mode 100644 index 00000000000..eb9a5813112 --- /dev/null +++ src/hg/inc/assemblySummary.h @@ -0,0 +1,115 @@ +/* assemblySummary.h was originally generated by the autoSql program, which also + * generated assemblySummary.c and assemblySummary.sql. This header links the database and + * the RAM representation of objects. */ + +#ifndef ASSEMBLYSUMMARY_H +#define ASSEMBLYSUMMARY_H + +#include "jksql.h" +#define ASSEMBLYSUMMARY_NUM_COLS 38 + +extern char *assemblySummaryCommaSepFieldNames; + +struct assemblySummary +/* NCBI assembly_summary data, see: https://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/README_assembly_summary.txt */ + { + struct assemblySummary *next; /* Next in singly linked list. */ + char *assemblyAccession; /* www.ncbi.nlm.nih.gov/assembly/?term=xxx */ + char *bioproject; /* www.ncbi.nlm.nih.gov/bioproject/?term=xxx */ + char *biosample; /* www.ncbi.nlm.nih.gov/biosample/?term=xxx */ + char *wgsMaster; /* www.ncbi.nlm.nih.gov/nuccore/xxx */ + char *refseqCategory; /* representative or reference */ + unsigned *taxId; /* www.ncbi.nlm.nih.gov/taxonomy/?term=xxx */ + unsigned *speciesTaxid; /* www.ncbi.nlm.nih.gov/taxonomy/?term=xxx */ + char *organismName; /* binomial scientific name */ + char *infraspecificName; /* strain/cultivar/ecotype/breed */ + char *isolate; /* source of sample */ + char *versionStatus; /* latest/suppressed/replaced */ + char *assemblyLevel; /* Contig/Scaffold/Complete Genome/Chromosome */ + char *releaseType; /* Major/Minor/Patch */ + char *genomeRep; /* Full/Partial */ + char *seqRelDate; /* date YYYY-MM-DD sequence released to INSDC */ + char *asmName; /* submitter supplied name */ + char *asmSubmitter; /* institution submitting assembly */ + char *gbrsPairedAsm; /* GenBank<->RefSeq GCA/GCF relationship */ + char *pairedAsmComp; /* identical/different for GCA<->GCF relationship */ + char *ftpPath; /* ftp.ncbi.nlm.nih.gov/genomes/all/GCx/012/345/678/asmId */ + char *excludedFromRefseq; /* noted reason for exclusion from RefSeq */ + char *relationToTypeMaterial; /* note of assembly relation to sample */ + char *asmNotLiveDate; /* date YYYY-MM-DD assembly suppressed/replaced -- historical files only */ + char *assemblyType; /* haploid/diploid/haploid-with-alt-loci/alternate-pseudohaplotype */ + char *taxonGroup; /* bacteria/viral/archaea/fungi/metagenomes/invertebrate/other/vertebrate_other/plant/vertebrate_mammalian/protozoa */ + long long *genomeSize; /* total length of all top-level sequences in the primary assembly */ + long long *genomeSizeUngapped; /* genome length not counting gaps (gap == 10 or more Ns) */ + float *gcPercent; /* GC percent */ + unsigned *repliconCount; /* total number of chromosomes, organelle genomes and plasmids */ + unsigned *scaffoldCount; /* number of scaffolds: placed, unlocalized, unplaced, alternate loci and patch */ + unsigned *contigCount; /* number of contigs in the primary assembly */ + char *annotationProvider; /* the group that provided the annotation on the assembly */ + char *annotationName; /* the name of the annotation */ + char *annotationDate; /* annotation date YYYY-MM-DD */ + unsigned *totalGeneCount; /* total gene count in annotation */ + unsigned *proteinCodingGeneCount; /* protein coding gene count in annotation */ + unsigned *nonCodingGeneCount; /* non coding gene count in annotation */ + char *pubmedId; /* semicolon separated list of PubMed ID(s) */ + }; + +void assemblySummaryStaticLoadWithNull(char **row, struct assemblySummary *ret); +/* Load a row from assemblySummary table into ret. The contents of ret will + * be replaced at the next call to this function. */ + +struct assemblySummary *assemblySummaryLoadByQuery(struct sqlConnection *conn, char *query); +/* Load all assemblySummary 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 assemblySummaryFreeList(). */ + +void assemblySummarySaveToDb(struct sqlConnection *conn, struct assemblySummary *el, char *tableName, int updateSize); +/* Save assemblySummary 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 assemblySummary *assemblySummaryLoadWithNull(char **row); +/* Load a assemblySummary from row fetched with select * from assemblySummary + * from database. Dispose of this with assemblySummaryFree(). */ + +struct assemblySummary *assemblySummaryLoadAll(char *fileName); +/* Load all assemblySummary from whitespace-separated file. + * Dispose of this with assemblySummaryFreeList(). */ + +struct assemblySummary *assemblySummaryLoadAllByChar(char *fileName, char chopper); +/* Load all assemblySummary from chopper separated file. + * Dispose of this with assemblySummaryFreeList(). */ + +#define assemblySummaryLoadAllByTab(a) assemblySummaryLoadAllByChar(a, '\t'); +/* Load all assemblySummary from tab separated file. + * Dispose of this with assemblySummaryFreeList(). */ + +struct assemblySummary *assemblySummaryCommaIn(char **pS, struct assemblySummary *ret); +/* Create a assemblySummary out of a comma separated string. + * This will fill in ret if non-null, otherwise will + * return a new assemblySummary */ + +void assemblySummaryFree(struct assemblySummary **pEl); +/* Free a single dynamically allocated assemblySummary such as created + * with assemblySummaryLoad(). */ + +void assemblySummaryFreeList(struct assemblySummary **pList); +/* Free a list of dynamically allocated assemblySummary's */ + +void assemblySummaryOutput(struct assemblySummary *el, FILE *f, char sep, char lastSep); +/* Print out assemblySummary. Separate fields with sep. Follow last field with lastSep. */ + +#define assemblySummaryTabOut(el,f) assemblySummaryOutput(el,f,'\t','\n'); +/* Print out assemblySummary as a line in a tab-separated file. */ + +#define assemblySummaryCommaOut(el,f) assemblySummaryOutput(el,f,',',','); +/* Print out assemblySummary as a comma separated list including final comma. */ + +/* -------------------------------- End autoSql Generated Code -------------------------------- */ + +#endif /* ASSEMBLYSUMMARY_H */ +