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/annoGrator.c src/lib/annoGrator.c index 4ca39c7..4386787 100644 --- src/lib/annoGrator.c +++ src/lib/annoGrator.c @@ -189,64 +189,55 @@ /* Update filters and re-evaluate self->haveRJIncludeFilter */ { annoStreamerSetFilters(vSelf, newFilters); struct annoGrator *self = (struct annoGrator *)vSelf; self->haveRJIncludeFilter = filtersHaveRJInclude(vSelf->filters); } void annoGratorSetRegion(struct annoStreamer *vSelf, char *chrom, uint rStart, uint rEnd) /* Set genomic region for query, and reset internal state. */ { struct annoGrator *self = (struct annoGrator *)vSelf; self->mySource->setRegion((struct annoStreamer *)(self->mySource), chrom, rStart, rEnd); agReset(self); } -void annoGratorSetQuery(struct annoStreamer *vSelf, struct annoGratorQuery *query) -/* Set query (to be called only by annoGratorQuery which is created after streamers). */ -{ -struct annoGrator *self = (struct annoGrator *)vSelf; -self->streamer.query = query; -self->mySource->setQuery((struct annoStreamer *)(self->mySource), query); -} - static void agSetAutoSqlObject(struct annoStreamer *sSelf, struct asObject *asObj) /* Use new asObj and update internal state derived from asObj. */ { struct annoGrator *gSelf = (struct annoGrator *)sSelf; annoStreamerSetAutoSqlObject(sSelf, asObj); gSelf->haveRJIncludeFilter = filtersHaveRJInclude(sSelf->filters); } void agSetOverlapRule(struct annoGrator *self, enum annoGratorOverlap rule) /* Tell annoGrator how to handle overlap of its rows with primary row. */ { self->overlapRule = rule; } void annoGratorInit(struct annoGrator *self, struct annoStreamer *mySource) /* Initialize an integrator of columns from mySource with (positions of) * rows passed to integrate(). * mySource becomes property of the annoGrator. */ { struct annoStreamer *streamer = &(self->streamer); -annoStreamerInit(streamer, mySource->getAutoSqlObject(mySource)); +annoStreamerInit(streamer, mySource->assembly, mySource->getAutoSqlObject(mySource)); streamer->rowType = mySource->rowType; streamer->setAutoSqlObject = agSetAutoSqlObject; streamer->setFilters = agSetFilters; streamer->setRegion = annoGratorSetRegion; -streamer->setQuery = annoGratorSetQuery; streamer->nextRow = noNextRow; streamer->close = annoGratorClose; self->qLm = lmInit(0); self->integrate = annoGratorIntegrate; self->setOverlapRule = agSetOverlapRule; self->overlapRule = agoNoConstraint; self->mySource = mySource; self->haveRJIncludeFilter = filtersHaveRJInclude(streamer->filters); } struct annoGrator *annoGratorNew(struct annoStreamer *mySource) /* Make a new integrator of columns from mySource with (positions of) rows passed to integrate(). * mySource becomes property of the new annoGrator. */ { struct annoGrator *self;