047c85400af7d7ce10d040bd0dfce223d0054129
braney
  Thu Feb 16 14:52:37 2023 -0800
fixup bigChain support to load the links at load time instead of draw
time

diff --git src/hg/hgTracks/chainTrack.c src/hg/hgTracks/chainTrack.c
index da88e8d..eac2b0c 100644
--- src/hg/hgTracks/chainTrack.c
+++ src/hg/hgTracks/chainTrack.c
@@ -341,30 +341,31 @@
  * frees the simple features again. */
 {
 
 if (tg->items == NULL)		/*Exit Early if nothing to do */
     return;
 
 linkedFeaturesDraw(tg, seqStart, seqEnd, hvg, xOff, yOff, width,
 	font, color, vis);
 }
 
 void bigChainLoadItems(struct track *tg)
 /* Load up all of the chains from correct table into tg->items
  * item list.  At this stage to conserve memory for other tracks
  * we don't load the links into the components list until draw time. */
 {
+boolean doSnake = cartOrTdbBoolean(cart, tg->tdb, "doSnake" , FALSE);
 struct linkedFeatures *list = NULL, *lf;
 int qs;
 char *optionChrStr;
 struct cartOptions *chainCart;
 
 chainCart = (struct cartOptions *) tg->extraUiData;
 
 optionChrStr = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE,
 	"chromFilter");
 
 struct bbiFile *bbi =  fetchBbiForTrack(tg);
 struct lm *lm = lmInit(0);
 struct bigBedInterval *bb, *bbList =  bigBedIntervalQuery(bbi, chromName, winStart, winEnd, 0, lm);
 int fieldCount = 11;
 char *bedRow[fieldCount];
@@ -388,48 +389,54 @@
         0, 1000, FALSE);
 
     if (*bedRow[5] == '-')
 	{
 	lf->orientation = -1;
         qs = sqlUnsigned(bedRow[8]) - sqlUnsigned(bedRow[10]);
 	}
     else
         {
 	lf->orientation = 1;
 	qs = sqlUnsigned(bedRow[9]);
 	}
 
     int len = strlen(bedRow[7]) + 32;
     lf->name = needMem(len);
+    if (!doSnake)
         safef(lf->name, len, "%s %c %dk", bedRow[7], *bedRow[5], qs/1000);
+    else
+        safef(lf->name, len, "%s", bedRow[7]);
     lf->extra = cloneString(bedRow[3]);
     lf->components = NULL;
     slAddHead(&list, lf);
     }
 
 /* Make sure this is sorted if in full mode. Sort by score when
  * coloring by score and in dense */
 if (tg->visibility != tvDense)
     slSort(&list, linkedFeaturesCmpStart);
 else if ((tg->visibility == tvDense) &&
 	(chainCart->chainColor == chainColorScoreColors))
     slSort(&list, chainCmpScore);
 else
     slReverse(&list);
 tg->items = list;
 
 bbiFileClose(&bbi);
+
+loadLinks(tg, winStart, winEnd, tvFull);
+maybeLoadSnake(tg);
 }
 
 void chainLoadItems(struct track *tg)
 /* Load up all of the chains from correct table into tg->items
  * item list.  At this stage to conserve memory for other tracks
  * we don't load the links into the components list until draw time. */
 {
 boolean doSnake = cartOrTdbBoolean(cart, tg->tdb, "doSnake" , FALSE);
 char *table = tg->table;
 struct chain chain;
 int rowOffset;
 char **row;
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr = NULL;
 struct linkedFeatures *list = NULL, *lf;