69f8f2e39762a07c31e33a52d71dc58b331f4a0d angie Mon Jun 23 10:20:19 2014 -0700 Removed getFilters method from annoStreamer because it's not needed andit requires annoFilterCloneList, which I'm going to get rid of next because it requires too much knowledge about the contents of the filters. Also adding addFilters method for incrementally building up filters. diff --git src/lib/annoGrator.c src/lib/annoGrator.c index ff2df02..15a2396 100644 --- src/lib/annoGrator.c +++ src/lib/annoGrator.c @@ -204,35 +204,47 @@ self->qHead = self->qTail = NULL; self->qSkippedCount = 0; } static boolean filtersHaveRJInclude(struct annoFilter *filters) /* Return TRUE if filters have at least one active filter with !isExclude && rightJoin. */ { struct annoFilter *filter; for (filter = filters; filter != NULL; filter = filter->next) if (filter->op != afNoFilter && !filter->isExclude && filter->rightJoin) return TRUE; return FALSE; } static void agSetFilters(struct annoStreamer *vSelf, struct annoFilter *newFilters) -/* Update filters and re-evaluate self->haveRJIncludeFilter */ +/* Replace filters and re-evaluate self->haveRJIncludeFilter. Apply filters to + * own streamer interface and to internal source. */ { annoStreamerSetFilters(vSelf, newFilters); struct annoGrator *self = (struct annoGrator *)vSelf; self->haveRJIncludeFilter = filtersHaveRJInclude(vSelf->filters); +self->mySource->setFilters(self->mySource, newFilters); +} + +static void agAddFilters(struct annoStreamer *vSelf, struct annoFilter *newFilters) +/* Add filters and re-evaluate self->haveRJIncludeFilter. Apply filters to + * own streamer interface and to internal source. */ +{ +annoStreamerAddFilters(vSelf, newFilters); +struct annoGrator *self = (struct annoGrator *)vSelf; +annoStreamerSetFilters(self->mySource, vSelf->filters); +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); } 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); @@ -244,30 +256,31 @@ { 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->assembly, mySource->getAutoSqlObject(mySource), mySource->name); streamer->rowType = mySource->rowType; streamer->setAutoSqlObject = agSetAutoSqlObject; streamer->setFilters = agSetFilters; +streamer->addFilters = agAddFilters; streamer->setRegion = annoGratorSetRegion; 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. */ {