4c1d2a0a761f1afc9da81243357e462ae14c3756 braney Thu Dec 15 14:49:26 2022 -0800 add assembly aliasing to hub connection diff --git src/hg/inc/asmAlias.h src/hg/inc/asmAlias.h new file mode 100644 index 0000000..e65706b --- /dev/null +++ src/hg/inc/asmAlias.h @@ -0,0 +1,82 @@ +/* asmAlias.h was originally generated by the autoSql program, which also + * generated asmAlias.c and asmAlias.sql. This header links the database and + * the RAM representation of objects. */ + +#ifndef ASMALIAS_H +#define ASMALIAS_H + +#include "jksql.h" +#define ASMALIAS_NUM_COLS 2 + +extern char *asmAliasCommaSepFieldNames; + +struct asmAlias +/* correspondence of assembly identifiers to UCSC database or GenArk hub equivalents */ + { + struct asmAlias *next; /* Next in singly linked list. */ + char *alias; /* external assembly name */ + char *browser; /* UCSC genome browser equivalent */ + }; + +void asmAliasStaticLoad(char **row, struct asmAlias *ret); +/* Load a row from asmAlias table into ret. The contents of ret will + * be replaced at the next call to this function. */ + +struct asmAlias *asmAliasLoadByQuery(struct sqlConnection *conn, char *query); +/* Load all asmAlias 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 asmAliasFreeList(). */ + +void asmAliasSaveToDb(struct sqlConnection *conn, struct asmAlias *el, char *tableName, int updateSize); +/* Save asmAlias 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 asmAlias *asmAliasLoad(char **row); +/* Load a asmAlias from row fetched with select * from asmAlias + * from database. Dispose of this with asmAliasFree(). */ + +struct asmAlias *asmAliasLoadAll(char *fileName); +/* Load all asmAlias from whitespace-separated file. + * Dispose of this with asmAliasFreeList(). */ + +struct asmAlias *asmAliasLoadAllByChar(char *fileName, char chopper); +/* Load all asmAlias from chopper separated file. + * Dispose of this with asmAliasFreeList(). */ + +#define asmAliasLoadAllByTab(a) asmAliasLoadAllByChar(a, '\t'); +/* Load all asmAlias from tab separated file. + * Dispose of this with asmAliasFreeList(). */ + +struct asmAlias *asmAliasCommaIn(char **pS, struct asmAlias *ret); +/* Create a asmAlias out of a comma separated string. + * This will fill in ret if non-null, otherwise will + * return a new asmAlias */ + +void asmAliasFree(struct asmAlias **pEl); +/* Free a single dynamically allocated asmAlias such as created + * with asmAliasLoad(). */ + +void asmAliasFreeList(struct asmAlias **pList); +/* Free a list of dynamically allocated asmAlias's */ + +void asmAliasOutput(struct asmAlias *el, FILE *f, char sep, char lastSep); +/* Print out asmAlias. Separate fields with sep. Follow last field with lastSep. */ + +#define asmAliasTabOut(el,f) asmAliasOutput(el,f,'\t','\n'); +/* Print out asmAlias as a line in a tab-separated file. */ + +#define asmAliasCommaOut(el,f) asmAliasOutput(el,f,',',','); +/* Print out asmAlias as a comma separated list including final comma. */ + +/* -------------------------------- End autoSql Generated Code -------------------------------- */ + +char *asmAliasFind(char *alias); +/* If this assembly is an alias for a db we know about, return it. Otherwise return what we were sent. */ + +#endif /* ASMALIAS_H */ +