677b513b231891e30d32024de7ded7766ef72058
braney
  Wed May 24 14:09:42 2017 -0700
add mathWig track type which is an arithmetic combination of bigWi.

diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index d73b2ae..7a78088 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -4352,31 +4352,31 @@
         {
         if (nextItemCompatible(tg))
             genericDrawNextItemStuff(tg, hvg, vis, item, scale, x2, x1, textX, y, tg->heightPer, color, TRUE);
         else if (exonNumberMapsCompatible(tg, vis))
             genericDrawNextItemStuff(tg, hvg, vis, item, scale, x2, x1, textX, y, tg->heightPer, color, FALSE);
         else
             {
             tg->mapItem(tg, hvg, item, tg->itemName(tg, item),
                         tg->mapItemName(tg, item), s, e, textX, y, w, tg->heightPer);
             }
         }
     }
     withIndividualLabels = TRUE; /* reset in case done with pgSnp */
 }
 
-static int normalizeCount(struct preDrawElement *el, double countFactor,
+int normalizeCount(struct preDrawElement *el, double countFactor,
     double minVal, double maxVal, double sumData, double sumSquares)
 /* Normalize statistics to be based on an integer number of valid bases.
  * Integer value is the smallest integer not less than countFactor. */
 {
 bits32 validCount = ceil(countFactor);
 double normFactor = (double)validCount/countFactor;
 
 el->count = validCount;
 el->min = minVal;
 el->max = maxVal;
 el->sumData = sumData * normFactor;
 el->sumSquares = sumSquares * normFactor;
 
 return validCount;
 }
@@ -13832,30 +13832,36 @@
     tdb->canPack = TRUE;
     complexBedMethods(track, tdb, FALSE, wordCount, words);
     if (trackShouldUseAjaxRetrieval(tg))
         track->loadItems = dontLoadItems;
     }
 else if (sameWord(type, "longTabix"))
     {
     char *words[2];
     words[0] = type;
     words[1] = "5";
     complexBedMethods(track, tdb, FALSE, 2, words);
     longRangeMethods(track, tdb);
     if (trackShouldUseAjaxRetrieval(tg))
         track->loadItems = dontLoadItems;
     }
+else if (sameWord(type, "mathWig"))
+    {
+    mathWigMethods(track, tdb, wordCount, words);
+    if (trackShouldUseAjaxRetrieval(track))
+        track->loadItems = dontLoadItems;
+    }
 else if (sameWord(type, "bigBed"))
     {
     bigBedMethods(track, tdb, wordCount, words);
     if (trackShouldUseAjaxRetrieval(track))
         track->loadItems = dontLoadItems;
     }
 else if (sameWord(type, "bigMaf"))
     {
     tdb->canPack = TRUE;
     wordCount++;
     words[1] = "3";
     wigMafMethods(track, tdb, wordCount, words);
     track->isBigBed = TRUE;
     if (trackShouldUseAjaxRetrieval(track))
         track->loadItems = dontLoadItems;