b973bf71d1f2ed60125517f6fa69923a6faca7fa
braney
  Sun Apr 7 15:55:16 2019 -0700
add bigBed filtering to bigLolly

diff --git src/hg/hgTracks/lolly.c src/hg/hgTracks/lolly.c
index af7aa93..2269d35 100644
--- src/hg/hgTracks/lolly.c
+++ src/hg/hgTracks/lolly.c
@@ -1,28 +1,29 @@
 /* lolly -- load and draw lollys */
 
 /* Copyright (C) 2019 The Regents of the University of California 
  * See README in this or parent directory for licensing information. */
 
 #include "common.h"
 #include "obscure.h"
 #include "hgTracks.h"
 #include "bedCart.h"
 #include "bigWarn.h"
 #include "lolly.h"
 #include "limits.h"
 #include "float.h"
+#include "bigBedFilter.h"
 
 
 static int lollyPalette[] =
 {
 0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728, 0x9467bd, 0x8c564b, 0xe377c2, 0x7f7f7f, 0xbcbd22, 0x17becf
 };
 
 struct lolly
 {
 struct lolly *next;
 char *name;
 double val;
 unsigned start;
 unsigned end;
 unsigned radius;
@@ -137,30 +138,35 @@
 struct lollyCartOptions *lollyCart = tg->lollyCart;
 char *setting = trackDbSetting(tg->tdb, "lollyField");
 if (setting != NULL)
     lollyField = atoi(setting);
 double minVal = DBL_MAX, maxVal = -DBL_MAX;
 
 
 double sumData = 0.0, sumSquares = 0.0;
 unsigned count = 0;
 
 int trackHeight = tg->lollyCart->height;
                     
 for (bb = bbList; bb != NULL; bb = bb->next)
     {
     bigBedIntervalToRow(bb, chromName, startBuf, endBuf, bedRow, ArraySize(bedRow));
+
+    struct bigBedFilter *filters = bigBedBuildFilters(cart, bbi, tg->tdb);
+    if (!bigBedFilterInterval(bedRow, filters))
+        continue;
+
     double val = atof(bedRow[lollyField - 1]);
     if (!((lollyCart->autoScale == wiggleScaleAuto) ||  ((val >= lollyCart->minY) && (val <= lollyCart->maxY) )))
         continue;
 
     AllocVar(pop);
     slAddHead(&popList, pop);
     pop->val = val;
     pop->start = atoi(bedRow[1]);
     pop->end = atoi(bedRow[2]);
     pop->name = cloneString(bedRow[3]);
     count++;
     sumData += val;
     sumSquares += val * val;
     if (val > maxVal)
         maxVal = val;