e2ec5ef77645a662ba31c7cfbd7499794975275a
angie
  Fri Mar 23 16:44:07 2012 -0700
Feature #6152 (Variant Annotation Tool): Initial work, squashed infrom origin/annoGrator branch.  Superclasses annoColumn, annoFilter,
annoRow, annoStreamer, annoGrator, and annoFormatter define the core
interfaces for passing data and configuration to and from components.
The annoGrator superclass can join annoRows on position and pass
forward all rows of secondary source.  The annoGratorQuery module
orchestrates the passing of annoRows between the primary source,
annoGrator(s) and annoFormatter(s).  The subclasses annoStreamDb and
annoFormatTab, together with hg/lib/tests/annoGratorTester.c, can join
columns of two database tables such as hg19's pgNA12878 and knownGene
into tab-separated output.

diff --git src/inc/annoGratorQuery.h src/inc/annoGratorQuery.h
new file mode 100644
index 0000000..0a5cfc2
--- /dev/null
+++ src/inc/annoGratorQuery.h
@@ -0,0 +1,44 @@
+/* annoGratorQuery -- framework for integrating genomic annotations from many sources */
+
+#ifndef ANNOGRATORQUERY_H
+#define ANNOGRATORQUERY_H
+
+#include "annoFormatter.h"
+#include "annoGrator.h"
+#include "hash.h"
+#include "twoBit.h"
+
+struct annoGratorQuery
+/* Representation of a complex query: multiple sources, each with its own filters,
+ * output data and means of integration, aggregated and output by a formatter. */
+    {
+    // Private members -- callers are on the honor system to leave these alone. Use functions below.
+    char *assemblyName;			// Usually a UCSC db name like "hg19".
+    struct hash *chromSizes;		// Assembly seq sizes, must be valid for all inputs
+    struct twoBitFile *tbf;		// Assembly sequence, must be valid for all inputs
+    struct annoStreamer *primarySource;	// Annotations to be integrated with other annos.
+    struct annoGrator *integrators;	// Annotations & methods for integrating w/primary
+    struct annoFormatter *formatters;	// Writers of output collected from primary & intg's
+    boolean csAllocdHere;		// internal use only.
+    };
+
+struct annoGratorQuery *annoGratorQueryNew(char *assemblyName, struct hash *chromSizes,
+					   struct twoBitFile *tbf,
+					   struct annoStreamer *primarySource,
+					   struct annoGrator *integrators,
+					   struct annoFormatter *formatters);
+/* Create an annoGratorQuery from all of its components, and introduce components to each other.
+ * Either chromSizes or tbf may be NULL.  integrators may be NULL.
+ * All other inputs must be non-NULL. */
+
+void annoGratorQuerySetRegion(struct annoGratorQuery *query, char *chrom, uint rStart, uint rEnd);
+/* Set genomic region for query; if chrom is NULL, position is whole genome. */
+
+void annoGratorQueryExecute(struct annoGratorQuery *query);
+/* For each annoRow from query->primarySource, invoke integrators and
+ * pass their annoRows to formatters. */
+
+void annoGratorQueryFree(struct annoGratorQuery **pQuery);
+/* Close and free all inputs and outputs; free self. */
+
+#endif//ndef ANNOGRATORQUERY_H