b9d0da564a59df8c6aac4f4e28d391edcade591c braney Wed Apr 12 14:17:46 2017 -0700 add support for 64-bit indices to twoBitMask diff --git src/lib/twoBit.c src/lib/twoBit.c index 5db09d2..a7914fc 100644 --- src/lib/twoBit.c +++ src/lib/twoBit.c @@ -637,48 +637,56 @@ struct twoBit *twoBitOneFromFile(struct twoBitFile *tbf, char *name) /* Get single sequence as two bit. */ { struct twoBit *twoBit = readTwoBitSeqHeader(tbf, name); bits32 packByteCount; void *f = tbf->f; /* Read in data. */ packByteCount = packedSize(twoBit->size); twoBit->data = needLargeMem(packByteCount); (*tbf->ourMustRead)(f, twoBit->data, packByteCount); return twoBit; } -struct twoBit *twoBitFromFile(char *fileName) +struct twoBit *twoBitFromOpenFile(struct twoBitFile *tbf) /* Get twoBit list of all sequences in twoBit file. */ { -struct twoBitFile *tbf = twoBitOpen(fileName); struct twoBitIndex *index; struct twoBit *twoBitList = NULL; for (index = tbf->indexList; index != NULL; index = index->next) { struct twoBit *twoBit = twoBitOneFromFile(tbf, index->name); slAddHead(&twoBitList, twoBit); } twoBitClose(&tbf); slReverse(&twoBitList); return twoBitList; } +struct twoBit *twoBitFromFile(char *fileName) +/* Get twoBit list of all sequences in already open twoBit file. */ +{ +struct twoBitFile *tbf = twoBitOpen(fileName); + +return twoBitFromOpenFile(tbf); +} + + void twoBitFree(struct twoBit **pTwoBit) /* Free up a two bit structure. */ { struct twoBit *twoBit = *pTwoBit; if (twoBit != NULL) { freeMem(twoBit->nStarts); freeMem(twoBit->nSizes); freeMem(twoBit->maskStarts); freeMem(twoBit->maskSizes); freeMem(twoBit->data); freez(pTwoBit); } }