14b9ad8df1f99ac5300f52cda10ce8066c9289c6
braney
  Wed Dec 17 12:40:40 2025 -0800
use the bigBed header for the number of bed fields if it is NOT
specified in trackDb, otherwise use the number in the trackDb type.

diff --git src/hg/hgTracks/bigBedTrack.c src/hg/hgTracks/bigBedTrack.c
index eb89704d949..3cc7ce3381c 100644
--- src/hg/hgTracks/bigBedTrack.c
+++ src/hg/hgTracks/bigBedTrack.c
@@ -694,33 +694,33 @@
 struct errCatch *errCatch = errCatchNew();
 if (errCatchStart(errCatch))
     {
     bbi = fetchBbiForTrack(track);
     }
 errCatchEnd(errCatch);
 if (errCatch->gotError)
     {
     track->networkErrMsg = cloneString(errCatch->message->string);
     track->drawItems = bigDrawWarning;
     track->totalHeight = bigWarnTotalHeight;
     return;
     }
 errCatchFree(&errCatch);
 
+fieldCount = track->bedSize;
 boolean bigBedOnePath = cfgOptionBooleanDefault("bigBedOnePath", FALSE);
-if (bigBedOnePath )
-    // always use the definedFieldCount as gospel
+if (bigBedOnePath  && (fieldCount == 0))
     track->bedSize = fieldCount = bbi->definedFieldCount;
 
 struct bigBedInterval *bb, *bbList; 
 char *quickLiftFile = cloneString(trackDbSetting(track->tdb, "quickLiftUrl"));
 struct hash *chainHash = NULL;
 if (quickLiftFile)
     bbList = quickLiftGetIntervals(quickLiftFile, bbi, chromName, winStart, winEnd, &chainHash);
 else
     bbList = bigBedSelectRangeExt(track, chrom, start, end, lm, maxItems);
 
 char *squishField = cartOrTdbString(cart, track->tdb, "squishyPackField", NULL);
 int squishFieldIdx = bbExtraFieldIndex(bbi, squishField);
 
 int seqTypeField =  0;
 if (sameString(track->tdb->type, "bigPsl"))
@@ -1039,36 +1039,32 @@
 #endif
 
 void commonBigBedMethods(struct track *track, struct trackDb *tdb, 
                                 int wordCount, char *words[])
 /* Set up common bigBed methods used by several track types that depend on the bigBed format. */
 {
 boolean bigBedOnePath = cfgOptionBooleanDefault("bigBedOnePath", FALSE);
 
 if (bigBedOnePath)
     {
     track->isBigBed = TRUE;
     linkedFeaturesMethods(track);
     track->extraUiData = newBedUiData(track->track);
     track->loadItems = loadGappedBed;
 
-    // make sure that hgTracks completely ignore the items following "bigBed" in the type line
-    char *type = cloneString(tdb->type);
-    char *space = strchr(type, ' ');
-    if (space)
-        *space = 0;
-    tdb->type = type;
+    if (wordCount > 1)
+        track->bedSize = atoi(words[1]);
 
     if (trackDbSetting(tdb, "colorByStrand"))
         {
         Color lfItemColorByStrand(struct track *tg, void *item, struct hvGfx *hvg);
         track->itemColor = lfItemColorByStrand;
         }
     }
 else 
     {
     char *newWords[wordCount];
 
     int ii;
     for(ii=0; ii < wordCount; ii++)
         newWords[ii] = words[ii];