7f98bf75bd712a44b8ed9ededdd10e0f387cd35a
angie
  Thu Aug 13 10:31:58 2015 -0700
Moved averaging of wiggle values back from annoFormatTab to annoGrateWig,
so that it can be done properly across multiple regions with data.
A user was trying to get average GC over 1MB regions, but averages of
smaller subregions were returned instead.
refs #15834

diff --git src/inc/annoRow.h src/inc/annoRow.h
index 9c94b1f..3bd63ab 100644
--- src/inc/annoRow.h
+++ src/inc/annoRow.h
@@ -1,43 +1,50 @@
 /* annoRow -- basic data interchange unit of annoGratorQuery framework. */
 
 #ifndef ANNOROW_H
 #define ANNOROW_H
 
 #include "common.h"
 #include "localmem.h"
 
-enum annoRowType { arUnknown, arWords, arWig };
+enum annoRowType { arUnknown, arWords, arWigVec, arWigSingle };
 
 struct annoRow
 /* Representation of a row from a database table or file.  The chrom, start and end
  * facilitate intersection by position.  If type is arWords, then data is an array
  * of strings corresponding to columns in the autoSql definition provided by the
- * source of the annoRow.  If type is arWig, then data is an array of floats.
+ * source of the annoRow.  If type is arWigVec, then data is an array of floats.
+ * If type is arWigSingle, then data is an array of doubles with length 1.
  * rightJoinFail is true if this row failed a filter marked as rightJoin, meaning it
  * can knock out the primary row (see annoFilter.h). */
     {
     struct annoRow *next;
     char *chrom;
     uint start;
     uint end;
     void *data;
     boolean rightJoinFail;
     };
 
 struct annoRow *annoRowFromStringArray(char *chrom, uint start, uint end, boolean rightJoinFail,
 				       char **wordsIn, int numCols, struct lm *lm);
-/* Allocate & return an annoRow with data cloned from wordsIn. */
+/* Allocate & return an annoRow (type arWords) with data cloned from wordsIn. */
 
-struct annoRow *annoRowWigNew(char *chrom, uint start, uint end, boolean rightJoinFail,
+struct annoRow *annoRowWigVecNew(char *chrom, uint start, uint end, boolean rightJoinFail,
                                  float *values, struct lm *lm);
-/* Allocate & return an annoRowWig, with clone of values; length of values is (end-start). */
+/* Allocate & return an annoRow (type arWigVec), with cloned per-base values;
+ * length of values is (end-start). */
+
+struct annoRow *annoRowWigSingleNew(char *chrom, uint start, uint end, boolean rightJoinFail,
+                                    double value, struct lm *lm);
+/* Allocate & return an annoRow (type arWigSingle), which contains a single value for
+ * all bases from start to end. */
 
 struct annoRow *annoRowClone(struct annoRow *rowIn, enum annoRowType rowType, int numCols,
 			     struct lm *lm);
 /* Allocate & return a single annoRow cloned from rowIn.  If rowIn is NULL, return NULL.
- * If type is arWig, numCols is ignored. */
+ * If type is arWig*, numCols is ignored. */
 
 int annoRowCmp(const void *va, const void *vb);
 /* Compare two annoRows' {chrom, start, end}. */
 
 #endif//ndef ANNOROW_H