95efc27edf24bba8d0c7e53d2ef4aead59982826 braney Mon Jun 15 18:29:39 2020 -0700 Merging in our gencode merge code to master branch diff --git src/hg/lib/gencodeTranscriptionSupportLevel.c src/hg/lib/gencodeTranscriptionSupportLevel.c new file mode 100644 index 0000000..c4272b3 --- /dev/null +++ src/hg/lib/gencodeTranscriptionSupportLevel.c @@ -0,0 +1,126 @@ +/* gencodeTranscriptionSupportLevel.c was originally generated by the autoSql program, which also + * generated gencodeTranscriptionSupportLevel.h and gencodeTranscriptionSupportLevel.sql. This module links the database and + * the RAM representation of objects. */ + +#include "common.h" +#include "linefile.h" +#include "dystring.h" +#include "jksql.h" +#include "gencodeTranscriptionSupportLevel.h" + + + +char *gencodeTranscriptionSupportLevelCommaSepFieldNames = "transcriptId,level"; + +void gencodeTranscriptionSupportLevelStaticLoad(char **row, struct gencodeTranscriptionSupportLevel *ret) +/* Load a row from gencodeTranscriptionSupportLevel table into ret. The contents of ret will + * be replaced at the next call to this function. */ +{ + +ret->transcriptId = row[0]; +ret->level = row[1]; +} + +struct gencodeTranscriptionSupportLevel *gencodeTranscriptionSupportLevelLoad(char **row) +/* Load a gencodeTranscriptionSupportLevel from row fetched with select * from gencodeTranscriptionSupportLevel + * from database. Dispose of this with gencodeTranscriptionSupportLevelFree(). */ +{ +struct gencodeTranscriptionSupportLevel *ret; + +AllocVar(ret); +ret->transcriptId = cloneString(row[0]); +ret->level = cloneString(row[1]); +return ret; +} + +struct gencodeTranscriptionSupportLevel *gencodeTranscriptionSupportLevelLoadAll(char *fileName) +/* Load all gencodeTranscriptionSupportLevel from a whitespace-separated file. + * Dispose of this with gencodeTranscriptionSupportLevelFreeList(). */ +{ +struct gencodeTranscriptionSupportLevel *list = NULL, *el; +struct lineFile *lf = lineFileOpen(fileName, TRUE); +char *row[2]; + +while (lineFileRow(lf, row)) + { + el = gencodeTranscriptionSupportLevelLoad(row); + slAddHead(&list, el); + } +lineFileClose(&lf); +slReverse(&list); +return list; +} + +struct gencodeTranscriptionSupportLevel *gencodeTranscriptionSupportLevelLoadAllByChar(char *fileName, char chopper) +/* Load all gencodeTranscriptionSupportLevel from a chopper separated file. + * Dispose of this with gencodeTranscriptionSupportLevelFreeList(). */ +{ +struct gencodeTranscriptionSupportLevel *list = NULL, *el; +struct lineFile *lf = lineFileOpen(fileName, TRUE); +char *row[2]; + +while (lineFileNextCharRow(lf, chopper, row, ArraySize(row))) + { + el = gencodeTranscriptionSupportLevelLoad(row); + slAddHead(&list, el); + } +lineFileClose(&lf); +slReverse(&list); +return list; +} + +struct gencodeTranscriptionSupportLevel *gencodeTranscriptionSupportLevelCommaIn(char **pS, struct gencodeTranscriptionSupportLevel *ret) +/* Create a gencodeTranscriptionSupportLevel out of a comma separated string. + * This will fill in ret if non-null, otherwise will + * return a new gencodeTranscriptionSupportLevel */ +{ +char *s = *pS; + +if (ret == NULL) + AllocVar(ret); +ret->transcriptId = sqlStringComma(&s); +ret->level = sqlStringComma(&s); +*pS = s; +return ret; +} + +void gencodeTranscriptionSupportLevelFree(struct gencodeTranscriptionSupportLevel **pEl) +/* Free a single dynamically allocated gencodeTranscriptionSupportLevel such as created + * with gencodeTranscriptionSupportLevelLoad(). */ +{ +struct gencodeTranscriptionSupportLevel *el; + +if ((el = *pEl) == NULL) return; +freeMem(el->transcriptId); +freeMem(el->level); +freez(pEl); +} + +void gencodeTranscriptionSupportLevelFreeList(struct gencodeTranscriptionSupportLevel **pList) +/* Free a list of dynamically allocated gencodeTranscriptionSupportLevel's */ +{ +struct gencodeTranscriptionSupportLevel *el, *next; + +for (el = *pList; el != NULL; el = next) + { + next = el->next; + gencodeTranscriptionSupportLevelFree(&el); + } +*pList = NULL; +} + +void gencodeTranscriptionSupportLevelOutput(struct gencodeTranscriptionSupportLevel *el, FILE *f, char sep, char lastSep) +/* Print out gencodeTranscriptionSupportLevel. Separate fields with sep. Follow last field with lastSep. */ +{ +if (sep == ',') fputc('"',f); +fprintf(f, "%s", el->transcriptId); +if (sep == ',') fputc('"',f); +fputc(sep,f); +if (sep == ',') fputc('"',f); +fprintf(f, "%s", el->level); +if (sep == ',') fputc('"',f); +fputc(lastSep,f); +} + +/* -------------------------------- End autoSql Generated Code -------------------------------- */ +