df66e5b7936616048e5503a03196ef1684a63a07 kate Wed Mar 16 12:07:50 2016 -0700 New schema for GTEX gene bed file. Removes bogus transcriptId and replaces transcriptClass with geneType. refs #15645 diff --git src/hg/lib/gtexTranscript.c src/hg/lib/gtexTranscript.c deleted file mode 100644 index 1bdcfe6..0000000 --- src/hg/lib/gtexTranscript.c +++ /dev/null @@ -1,162 +0,0 @@ -/* gtexTranscript.c was originally generated by the autoSql program, which also - * generated gtexTranscript.h and gtexTranscript.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 "gtexTranscript.h" - - - -char *gtexTranscriptCommaSepFieldNames = "geneId,transcriptName"; - -void gtexTranscriptStaticLoad(char **row, struct gtexTranscript *ret) -/* Load a row from gtexTranscript table into ret. The contents of ret will - * be replaced at the next call to this function. */ -{ - -ret->geneId = row[0]; -ret->transcriptName = row[1]; -} - -struct gtexTranscript *gtexTranscriptLoadByQuery(struct sqlConnection *conn, char *query) -/* Load all gtexTranscript 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 gtexTranscriptFreeList(). */ -{ -struct gtexTranscript *list = NULL, *el; -struct sqlResult *sr; -char **row; - -sr = sqlGetResult(conn, query); -while ((row = sqlNextRow(sr)) != NULL) - { - el = gtexTranscriptLoad(row); - slAddHead(&list, el); - } -slReverse(&list); -sqlFreeResult(&sr); -return list; -} - -void gtexTranscriptSaveToDb(struct sqlConnection *conn, struct gtexTranscript *el, char *tableName, int updateSize) -/* Save gtexTranscript 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 dyString *update = newDyString(updateSize); -sqlDyStringPrintf(update, "insert into %s values ( '%s','%s')", - tableName, el->geneId, el->transcriptName); -sqlUpdate(conn, update->string); -freeDyString(&update); -} - -struct gtexTranscript *gtexTranscriptLoad(char **row) -/* Load a gtexTranscript from row fetched with select * from gtexTranscript - * from database. Dispose of this with gtexTranscriptFree(). */ -{ -struct gtexTranscript *ret; - -AllocVar(ret); -ret->geneId = cloneString(row[0]); -ret->transcriptName = cloneString(row[1]); -return ret; -} - -struct gtexTranscript *gtexTranscriptLoadAll(char *fileName) -/* Load all gtexTranscript from a whitespace-separated file. - * Dispose of this with gtexTranscriptFreeList(). */ -{ -struct gtexTranscript *list = NULL, *el; -struct lineFile *lf = lineFileOpen(fileName, TRUE); -char *row[2]; - -while (lineFileRow(lf, row)) - { - el = gtexTranscriptLoad(row); - slAddHead(&list, el); - } -lineFileClose(&lf); -slReverse(&list); -return list; -} - -struct gtexTranscript *gtexTranscriptLoadAllByChar(char *fileName, char chopper) -/* Load all gtexTranscript from a chopper separated file. - * Dispose of this with gtexTranscriptFreeList(). */ -{ -struct gtexTranscript *list = NULL, *el; -struct lineFile *lf = lineFileOpen(fileName, TRUE); -char *row[2]; - -while (lineFileNextCharRow(lf, chopper, row, ArraySize(row))) - { - el = gtexTranscriptLoad(row); - slAddHead(&list, el); - } -lineFileClose(&lf); -slReverse(&list); -return list; -} - -struct gtexTranscript *gtexTranscriptCommaIn(char **pS, struct gtexTranscript *ret) -/* Create a gtexTranscript out of a comma separated string. - * This will fill in ret if non-null, otherwise will - * return a new gtexTranscript */ -{ -char *s = *pS; - -if (ret == NULL) - AllocVar(ret); -ret->geneId = sqlStringComma(&s); -ret->transcriptName = sqlStringComma(&s); -*pS = s; -return ret; -} - -void gtexTranscriptFree(struct gtexTranscript **pEl) -/* Free a single dynamically allocated gtexTranscript such as created - * with gtexTranscriptLoad(). */ -{ -struct gtexTranscript *el; - -if ((el = *pEl) == NULL) return; -freeMem(el->geneId); -freeMem(el->transcriptName); -freez(pEl); -} - -void gtexTranscriptFreeList(struct gtexTranscript **pList) -/* Free a list of dynamically allocated gtexTranscript's */ -{ -struct gtexTranscript *el, *next; - -for (el = *pList; el != NULL; el = next) - { - next = el->next; - gtexTranscriptFree(&el); - } -*pList = NULL; -} - -void gtexTranscriptOutput(struct gtexTranscript *el, FILE *f, char sep, char lastSep) -/* Print out gtexTranscript. Separate fields with sep. Follow last field with lastSep. */ -{ -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->geneId); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->transcriptName); -if (sep == ',') fputc('"',f); -fputc(lastSep,f); -} - -/* -------------------------------- End autoSql Generated Code -------------------------------- */ -