85be21057a058a0bdb12caac2bae553376442f5a angie Mon Apr 15 10:56:28 2013 -0700 Refactoring to remove dependencies on annoGratorQuery from streamers,grators and formatters. Instead, provide basic assembly info and explicitly pass streamers(/grators) along with the rows that they produced into formatters. ref #6152 diff --git src/lib/annoStreamVcf.c src/lib/annoStreamVcf.c index bb7df09..146d9d2 100644 --- src/lib/annoStreamVcf.c +++ src/lib/annoStreamVcf.c @@ -96,46 +96,47 @@ rightFail, words, self->numCols, callerLm); } static void asvClose(struct annoStreamer **pVSelf) /* Close VCF file and free self. */ { if (pVSelf == NULL) return; struct annoStreamVcf *self = *(struct annoStreamVcf **)pVSelf; vcfFileFree(&(self->vcff)); // Don't free self->record -- currently it belongs to vcff's localMem dyStringFree(&(self->dyGt)); annoStreamerFree(pVSelf); } -struct annoStreamer *annoStreamVcfNew(char *fileOrUrl, boolean isTabix, int maxRecords) +struct annoStreamer *annoStreamVcfNew(char *fileOrUrl, boolean isTabix, + struct annoAssembly *aa, int maxRecords) /* Create an annoStreamer (subclass) object from a VCF file, which may * or may not have been compressed and indexed by tabix. */ { int maxErr = -1; // don't errAbort on VCF format warnings/errs struct vcfFile *vcff; if (isTabix) vcff = vcfTabixFileMayOpen(fileOrUrl, NULL, 0, 0, maxErr, maxRecords); else vcff = vcfFileMayOpen(fileOrUrl, maxErr, maxRecords, FALSE); if (vcff == NULL) errAbort("Unable to open VCF: '%s'", fileOrUrl); struct annoStreamVcf *self; AllocVar(self); struct annoStreamer *streamer = &(self->streamer); struct asObject *asObj = vcfAsObj(); -annoStreamerInit(streamer, asObj); +annoStreamerInit(streamer, aa, asObj); streamer->rowType = arVcf; streamer->setRegion = asvSetRegion; streamer->getHeader = asvGetHeader; streamer->nextRow = asvNextRow; streamer->close = asvClose; self->vcff = vcff; self->dyGt = dyStringNew(1024); self->isTabix = isTabix; self->numCols = slCount(asObj->columnList); self->numFileCols = 8; if (vcff->genotypeCount > 0) self->numFileCols = 9 + vcff->genotypeCount; return (struct annoStreamer *)self; }