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/hg/lib/annoStreamWig.c src/hg/lib/annoStreamWig.c
index 19a34d0..6d5fb51 100644
--- src/hg/lib/annoStreamWig.c
+++ src/hg/lib/annoStreamWig.c
@@ -18,38 +18,30 @@
     struct annoStreamer streamer;	// Parent class members & methods / external interface
     // Private members
     struct annoStreamer *wigStr;	// Internal streamer for .wig as in wiggle db tables
     FILE *wibF;				// wib file handle
     char *wibFile;			// name of wib file on which wibF was opened
     };
 
 static void aswSetRegion(struct annoStreamer *vSelf, char *chrom, uint regionStart, uint regionEnd)
 /* Set region -- and free current sqlResult if there is one. */
 {
 annoStreamerSetRegion(vSelf, chrom, regionStart, regionEnd);
 struct annoStreamWig *self = (struct annoStreamWig *)vSelf;
 self->wigStr->setRegion(self->wigStr, chrom, regionStart, regionEnd);
 }
 
-static void aswSetQuery(struct annoStreamer *vSelf, struct annoGratorQuery *query)
-/* Set query (to be called only by annoGratorQuery which is created after streamers). */
-{
-annoStreamerSetQuery(vSelf, query);
-struct annoStreamWig *self = (struct annoStreamWig *)vSelf;
-self->wigStr->setQuery((struct annoStreamer *)(self->wigStr), query);
-}
-
 static void checkWibFile(struct annoStreamWig *self, char *wibFile)
 /* If self doesn't have a .wib file name and handle open, or if the new wibFile is
  * not the same as the old one, update self to use new wibFile. */
 {
 if (self->wibFile == NULL || !sameString(self->wibFile, wibFile))
     {
     carefulClose(&(self->wibF));
     freeMem(self->wibFile);
     self->wibFile = cloneString(wibFile);
     self->wibF = mustOpen(self->wibFile, "r");
     }
 }
 
 static void paranoidCheckSize(struct wiggle *wiggle)
 /* paranoid, consider taking this out when code is stable: */
@@ -123,30 +115,30 @@
     }
 return rowOut;
 }
 
 static void aswClose(struct annoStreamer **pVSelf)
 /* Free wiggleDataStream and self. */
 {
 if (pVSelf == NULL)
     return;
 struct annoStreamWig *self = *(struct annoStreamWig **)pVSelf;
 carefulClose(&(self->wibF));
 freeMem(self->wibFile);
 annoStreamerFree(pVSelf);
 }
 
-struct annoStreamer *annoStreamWigDbNew(char *db, char *table, int maxOutput)
+struct annoStreamer *annoStreamWigDbNew(char *db, char *table, struct annoAssembly *aa,
+					int maxOutput)
 /* Create an annoStreamer (subclass) object from a wiggle database table. */
 {
 struct annoStreamWig *self = NULL;
 AllocVar(self);
 struct annoStreamer *streamer = &(self->streamer);
-annoStreamerInit(streamer, asParseText(annoRowWigAsText));
+annoStreamerInit(streamer, aa, asParseText(annoRowWigAsText));
 streamer->rowType = arWig;
 streamer->setRegion = aswSetRegion;
-streamer->setQuery = aswSetQuery;
 streamer->nextRow = aswNextRow;
 streamer->close = aswClose;
-self->wigStr = annoStreamDbNew(db, table, asParseText(wiggleAsText));
+self->wigStr = annoStreamDbNew(db, table, aa, asParseText(wiggleAsText));
 return (struct annoStreamer *)self;
 }