c46be5cebadbe532ca7f7fc2a5cde930554c7ae7
braney
  Tue May 2 11:20:34 2017 -0700
first check in of hgComposite code.

diff --git src/hg/lib/hui.c src/hg/lib/hui.c
index b643e73..c4fd615 100644
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@ -37,30 +37,31 @@
 #include "vcf.h"
 #include "errCatch.h"
 #include "samAlignment.h"
 #include "makeItemsItem.h"
 #include "bedDetail.h"
 #include "pgSnp.h"
 #include "memgfx.h"
 #include "trackHub.h"
 #include "gtexUi.h"
 #include "genbank.h"
 #include "htmlPage.h"
 #include "longRange.h"
 #include "tagRepo.h"
 #include "fieldedTable.h"
 #include "barChartUi.h"
+#include "customComposite.h"
 
 #define SMALLBUF 256
 #define MAX_SUBGROUP 9
 #define ADD_BUTTON_LABEL        "add"
 #define CLEAR_BUTTON_LABEL      "clear"
 #define JBUFSIZE 2048
 
 
 #define DEF_BUTTON "<IMG id=\"btn_%s\" src=\"../images/%s\" alt=\"%s\">\n"
 #define DEF_BUTTON_JS "setCheckBoxesThatContain('%s',true,false,'%s','','%s');" \
 	       "setCheckBoxesThatContain('%s',false,false,'%s','_defOff','%s');" 
 #define DEFAULT_BUTTON(nameOrId,anc,beg,contains) \
     printf(DEF_BUTTON,(anc),"defaults_sm.png","default"); \
     safef(id, sizeof id, "btn_%s", (anc)); \
     jsOnEventByIdF("click", id, DEF_BUTTON_JS,(nameOrId),(beg),(contains),(nameOrId),(beg),(contains)); 
@@ -1752,61 +1753,88 @@
 return x;
 }
 
 char *wiggleGraphEnumToString(enum wiggleGraphOptEnum x)
 /* Convert from enum to string representation. */
 {
 return wiggleGraphOptions[x];
 }
 
 void wiggleGraphDropDown(char *var, char *curVal)
 /* Make drop down of options. */
 {
 cgiMakeDropList(var, wiggleGraphOptions, ArraySize(wiggleGraphOptions), curVal);
 }
 
+static char *aggregateExtraLabels[] =
+{
+"none",
+"transparent",
+"solid",
+"stacked",
+"add",
+"subtract",
+};
+
+static char *aggregateExtraValues[] =
+{
+WIG_AGGREGATE_NONE,
+WIG_AGGREGATE_TRANSPARENT,
+WIG_AGGREGATE_SOLID,
+WIG_AGGREGATE_STACKED,
+WIG_AGGREGATE_ADD,
+WIG_AGGREGATE_SUBSTRACT,
+};
+
 static char *aggregateLabels[] =
 {
 "none",
 "transparent",
 "solid",
 "stacked",
 };
 
 static char *aggregateValues[] =
 {
 WIG_AGGREGATE_NONE,
 WIG_AGGREGATE_TRANSPARENT,
 WIG_AGGREGATE_SOLID,
 WIG_AGGREGATE_STACKED,
 };
 
 char *wiggleAggregateFunctionEnumToString(enum wiggleAggregateFunctionEnum x)
 /* Convert from enum to string representation. */
 {
 return aggregateValues[x];
 }
 
 enum wiggleAggregateFunctionEnum wiggleAggregateFunctionStringToEnum(char *string)
 /* Convert from string to enum representation. */
 {
-int x = stringIx(string, aggregateValues);
+int x = stringIx(string, aggregateExtraValues);
 if (x < 0)
     errAbort("hui::wiggleAggregateFunctionStringToEnum() - Unknown option %s", string);
 return x;
 }
 
+void aggregateExtraDropDown(char *var, char *curVal)
+/* Make drop down menu for aggregate plus strategy */
+{
+cgiMakeDropListFull(var, aggregateExtraLabels, aggregateExtraValues,
+    ArraySize(aggregateExtraValues), curVal, NULL, NULL);
+}
+
 void aggregateDropDown(char *var, char *curVal)
 /* Make drop down menu for aggregate strategy */
 {
 cgiMakeDropListFull(var, aggregateLabels, aggregateValues,
     ArraySize(aggregateValues), curVal, NULL, NULL);
 }
 
 static char *wiggleTransformFuncOptions[] = 
     {
     "NONE",
     "LOG"
     };
 
 static char *wiggleTransformFuncLabels[] = 
     {
@@ -5097,30 +5125,33 @@
 boolean doNegative = wigFetchDoNegativeWithCart(cart,tdb,tdb->track, (char **) NULL);
 
 printf("<TABLE BORDER=0>");
 
 boolean parentLevel = isNameAtParentLevel(tdb, name);
 boolean didAggregate = FALSE;
 if (parentLevel)
     {
     assert(tdb->parent != NULL);
     char *aggregate = trackDbSetting(tdb->parent, "aggregate");
     if (aggregate != NULL && parentLevel)
         {
         char *aggregateVal = cartOrTdbString(cart, tdb->parent, "aggregate", NULL);
         printf("<TR valign=center><th align=right>Overlay method:</th><td align=left>");
         safef(option, sizeof(option), "%s.%s", name, AGGREGATE);
+        if (isCustomComposite(tdb))
+            aggregateExtraDropDown(option, aggregateVal);
+        else
             aggregateDropDown(option, aggregateVal);
         puts("</td></TR>");
 
 	if (sameString(aggregateVal, WIG_AGGREGATE_STACKED)  &&
 	    sameString(windowingFunction, "mean+whiskers"))
 	    {
 	    windowingFunction = "maximum";
 	    }
 
 	didAggregate = TRUE;
         }
     }
 
 printf("<TR valign=center><th align=right>Type of graph:</th><td align=left>");
 safef( option, sizeof(option), "%s.%s", name, LINEBAR );