36710988224ab9373893a97a6edc95e033b0d646
braney
  Fri Oct 18 08:52:28 2024 -0700
density mode on vcf tracks was crashing.  Refs #34659

diff --git src/hg/hgTracks/wigTrack.c src/hg/hgTracks/wigTrack.c
index 0a52b78..480bb25 100644
--- src/hg/hgTracks/wigTrack.c
+++ src/hg/hgTracks/wigTrack.c
@@ -2271,15 +2271,42 @@
 track->totalHeight = wigTotalHeight;
 track->itemHeight = tgFixedItemHeight;
 
 track->itemStart = tgItemNoStart;
 track->itemEnd = tgItemNoEnd;
 /*	the wigMaf parent will turn mapsSelf off	*/
 track->mapsSelf = TRUE;
 track->wigCartData = (void *) wigCart;
 track->colorShades = shadesOfGray;
 track->drawLeftLabels = wigLeftLabels;
 track->loadPreDraw = wigLoadPreDraw;
 /*	the lfSubSample type makes the image map function correctly */
 track->subType = lfSubSample;     /*make subType be "sample" (=2)*/
 
 }	/*	wigMethods()	*/
+
+
+int setupForWiggle(struct track *tg, enum trackVisibility vis)
+/* Check to see if this track should show density coverage and if so
+ * make sure it has the cart data to support it.
+ */
+{
+boolean doWiggle = checkIfWiggling(cart, tg);
+int height = 0;
+if (doWiggle)
+    {
+    struct wigCartOptions *wigCart = tg->wigCartData;
+    if (tg->wigCartData == NULL)
+	{
+        // fake the trackDb range for this auto-wiggle
+        int wordCount = 3;
+        char *words[3];
+        words[0] = "bedGraph";
+	wigCart = wigCartOptionsNew(cart, tg->tdb, wordCount, words );
+        wigCart->windowingFunction = wiggleWindowingMean;
+	tg->wigCartData = (void *) wigCart;
+	}
+    height = wigTotalHeight(tg, vis);
+    }
+return height;
+}
+