a93daa92b77f5717f8ff247cb049a46cd0f66409 markd Sun Aug 21 17:37:28 2022 -0700 add transcriptRank column to wgEncodeGencodeAttrs in preperation for getting transcript ranks in upcomming gencode distribution. Import GENCODE V42 prerelease to test out creating column diff --git src/hg/lib/encode/wgEncodeGencodeAttrs.c src/hg/lib/encode/wgEncodeGencodeAttrs.c index 51ba441..6ba7f95 100644 --- src/hg/lib/encode/wgEncodeGencodeAttrs.c +++ src/hg/lib/encode/wgEncodeGencodeAttrs.c @@ -1,73 +1,81 @@ /* wgEncodeGencodeAttrs.c was originally generated by the autoSql program, which also * generated wgEncodeGencodeAttrs.h and wgEncodeGencodeAttrs.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 "encode/wgEncodeGencodeAttrs.h" -char *wgEncodeGencodeAttrsCommaSepFieldNames = "geneId,geneName,geneType,geneStatus,transcriptId,transcriptName,transcriptType,transcriptStatus,havanaGeneId,havanaTranscriptId,ccdsId,level,transcriptClass,proteinId"; +char *wgEncodeGencodeAttrsCommaSepFieldNames = "geneId,geneName,geneType,geneStatus,transcriptId,transcriptName,transcriptType,transcriptStatus,havanaGeneId,havanaTranscriptId,ccdsId,level,transcriptClass,proteinId,transcriptRank"; void wgEncodeGencodeAttrsStaticLoad(char **row, int numColumns, struct wgEncodeGencodeAttrs *ret) /* Load a row from wgEncodeGencodeAttrs table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->geneId = row[0]; ret->geneName = row[1]; ret->geneType = row[2]; ret->geneStatus = row[3]; ret->transcriptId = row[4]; ret->transcriptName = row[5]; ret->transcriptType = row[6]; ret->transcriptStatus = row[7]; ret->havanaGeneId = row[8]; ret->havanaTranscriptId = row[9]; ret->ccdsId = row[10]; ret->level = sqlSigned(row[11]); ret->transcriptClass = row[12]; if (numColumns > 13) ret->proteinId = row[13]; +if (numColumns > 14) + ret->transcriptRank = sqlSigned(row[14]); +else + ret->transcriptRank = -1; } struct wgEncodeGencodeAttrs *wgEncodeGencodeAttrsLoad(char **row, int numColumns) /* Load a wgEncodeGencodeAttrs from row fetched with select * from wgEncodeGencodeAttrs * from database. Dispose of this with wgEncodeGencodeAttrsFree(). */ { struct wgEncodeGencodeAttrs *ret; AllocVar(ret); ret->geneId = cloneString(row[0]); ret->geneName = cloneString(row[1]); ret->geneType = cloneString(row[2]); ret->geneStatus = cloneString(row[3]); ret->transcriptId = cloneString(row[4]); ret->transcriptName = cloneString(row[5]); ret->transcriptType = cloneString(row[6]); ret->transcriptStatus = cloneString(row[7]); ret->havanaGeneId = cloneString(row[8]); ret->havanaTranscriptId = cloneString(row[9]); ret->ccdsId = cloneString(row[10]); ret->level = sqlSigned(row[11]); ret->transcriptClass = cloneString(row[12]); if (numColumns > 13) ret->proteinId = cloneString(row[13]); +if (numColumns > 14) + ret->transcriptRank = sqlSigned(row[14]); +else + ret->transcriptRank = -1; return ret; } struct wgEncodeGencodeAttrs *wgEncodeGencodeAttrsLoadAll(char *fileName) /* Load all wgEncodeGencodeAttrs from a whitespace-separated file. * Dispose of this with wgEncodeGencodeAttrsFreeList(). */ { struct wgEncodeGencodeAttrs *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[14]; while (lineFileRow(lf, row)) { el = wgEncodeGencodeAttrsLoad(row, WGENCODEGENCODEATTRS_NUM_COLS); slAddHead(&list, el); @@ -83,57 +91,30 @@ { struct wgEncodeGencodeAttrs *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[14]; while (lineFileNextCharRow(lf, chopper, row, ArraySize(row))) { el = wgEncodeGencodeAttrsLoad(row, WGENCODEGENCODEATTRS_NUM_COLS); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } -struct wgEncodeGencodeAttrs *wgEncodeGencodeAttrsCommaIn(char **pS, struct wgEncodeGencodeAttrs *ret) -/* Create a wgEncodeGencodeAttrs out of a comma separated string. - * This will fill in ret if non-null, otherwise will - * return a new wgEncodeGencodeAttrs */ -{ -char *s = *pS; - -if (ret == NULL) - AllocVar(ret); -ret->geneId = sqlStringComma(&s); -ret->geneName = sqlStringComma(&s); -ret->geneType = sqlStringComma(&s); -ret->geneStatus = sqlStringComma(&s); -ret->transcriptId = sqlStringComma(&s); -ret->transcriptName = sqlStringComma(&s); -ret->transcriptType = sqlStringComma(&s); -ret->transcriptStatus = sqlStringComma(&s); -ret->havanaGeneId = sqlStringComma(&s); -ret->havanaTranscriptId = sqlStringComma(&s); -ret->ccdsId = sqlStringComma(&s); -ret->level = sqlSignedComma(&s); -ret->transcriptClass = sqlStringComma(&s); -ret->proteinId = sqlStringComma(&s); -*pS = s; -return ret; -} - void wgEncodeGencodeAttrsFree(struct wgEncodeGencodeAttrs **pEl) /* Free a single dynamically allocated wgEncodeGencodeAttrs such as created * with wgEncodeGencodeAttrsLoad(). */ { struct wgEncodeGencodeAttrs *el; if ((el = *pEl) == NULL) return; freeMem(el->geneId); freeMem(el->geneName); freeMem(el->geneType); freeMem(el->geneStatus); freeMem(el->transcriptId); freeMem(el->transcriptName); freeMem(el->transcriptType); freeMem(el->transcriptStatus); @@ -202,20 +183,22 @@ if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->ccdsId); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%d", el->level); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->transcriptClass); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->proteinId); if (sep == ',') fputc('"',f); +fputc(sep,f); +fprintf(f, "%d", el->transcriptRank); fputc(lastSep,f); } /* -------------------------------- End autoSql Generated Code -------------------------------- */