afa4cc7f36a1d3d5c2e4dc4f20fbf6332a4258a3 hiram Thu Sep 15 11:28:56 2016 -0700 allow chrom name lookup to use the new chromXref table refs #18027 diff --git src/hg/lib/chromXref.h src/hg/lib/chromXref.h new file mode 100644 index 0000000..a6709fd --- /dev/null +++ src/hg/lib/chromXref.h @@ -0,0 +1,69 @@ +/* chromXref.h was originally generated by the autoSql program, which also + * generated chromXref.c and chromXref.sql. This header links the database and + * the RAM representation of objects. */ + +#ifndef CHROMXREF_H +#define CHROMXREF_H + +#define CHROMXREF_NUM_COLS 4 + +extern char *chromXrefCommaSepFieldNames; + +struct chromXref +/* correspondence of UCSC chromosome names to refseq, genbank, and ensembl names */ + { + struct chromXref *next; /* Next in singly linked list. */ + char *ucsc; /* UCSC genome browser chromosome name */ + char *refseq; /* RefSeq assembly accession (n/a when not available) */ + char *genbank; /* Genbank assembly accession (n/a when not available) */ + char *ensembl; /* Ensembl chromosome name (n/a when not available) */ + }; + +void chromXrefStaticLoad(char **row, struct chromXref *ret); +/* Load a row from chromXref table into ret. The contents of ret will + * be replaced at the next call to this function. */ + +struct chromXref *chromXrefLoad(char **row); +/* Load a chromXref from row fetched with select * from chromXref + * from database. Dispose of this with chromXrefFree(). */ + +struct chromXref *chromXrefLoadAll(char *fileName); +/* Load all chromXref from whitespace-separated file. + * Dispose of this with chromXrefFreeList(). */ + +struct chromXref *chromXrefLoadAllByChar(char *fileName, char chopper); +/* Load all chromXref from chopper separated file. + * Dispose of this with chromXrefFreeList(). */ + +#define chromXrefLoadAllByTab(a) chromXrefLoadAllByChar(a, '\t'); +/* Load all chromXref from tab separated file. + * Dispose of this with chromXrefFreeList(). */ + +struct chromXref *chromXrefCommaIn(char **pS, struct chromXref *ret); +/* Create a chromXref out of a comma separated string. + * This will fill in ret if non-null, otherwise will + * return a new chromXref */ + +void chromXrefFree(struct chromXref **pEl); +/* Free a single dynamically allocated chromXref such as created + * with chromXrefLoad(). */ + +void chromXrefFreeList(struct chromXref **pList); +/* Free a list of dynamically allocated chromXref's */ + +void chromXrefOutput(struct chromXref *el, FILE *f, char sep, char lastSep); +/* Print out chromXref. Separate fields with sep. Follow last field with lastSep. */ + +#define chromXrefTabOut(el,f) chromXrefOutput(el,f,'\t','\n'); +/* Print out chromXref as a line in a tab-separated file. */ + +#define chromXrefCommaOut(el,f) chromXrefOutput(el,f,',',','); +/* Print out chromXref as a comma separated list including final comma. */ + +void chromXrefJsonOutput(struct chromXref *el, FILE *f); +/* Print out chromXref in JSON format. */ + +/* -------------------------------- End autoSql Generated Code -------------------------------- */ + +#endif /* CHROMXREF_H */ +