370cc36518fec8f45d0053dec74a4af6ac7ff0cb
braney
  Thu Dec 11 09:12:31 2025 -0800
in bigBed click handling, if the trackDb type has a field number in it
make sure it's the same as the one in the bigBed itself, otherwise
print an error.

diff --git src/hg/hgc/bigBedClick.c src/hg/hgc/bigBedClick.c
index 72263adcb6d..2638b8dd9f9 100644
--- src/hg/hgc/bigBedClick.c
+++ src/hg/hgc/bigBedClick.c
@@ -3,30 +3,31 @@
 /* Copyright (C) 2013 The Regents of the University of California 
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
 
 #include "common.h"
 #include "wiggle.h"
 #include "cart.h"
 #include "hgc.h"
 #include "hCommon.h"
 #include "hgColors.h"
 #include "bigBed.h"
 #include "hui.h"
 #include "subText.h"
 #include "web.h"
 #include "chromAlias.h"
 #include "quickLift.h"
+#include "hgConfig.h"
 
 static void bigGenePredLinks(char *track, char *item)
 /* output links to genePred driven sequence dumps */
 {
 printf("<H3>Links to sequence:</H3>\n");
 printf("<UL>\n");
 puts("<LI>\n");
 hgcAnchorSomewhere("htcTranslatedPredMRna", item, "translate", seqName);
 printf("Translated Protein</A> from genomic DNA\n");
 puts("</LI>\n");
 
 puts("<LI>\n");
 hgcAnchorSomewhere("htcGeneMrna", item, track, seqName);
 printf("Predicted mRNA</A> \n");
 puts("</LI>\n");
@@ -377,35 +378,42 @@
 if (start == end)
     {
     // item is an insertion; expand the search range from 0 bases to 2 so we catch it:
     ivStart = max(0, start-1);
     ivEnd++;
     }
 char *quickLiftFile = cloneString(trackDbSetting(tdb, "quickLiftUrl"));
 struct hash *chainHash = NULL;
 struct bigBedInterval *bbList = NULL;
 if (quickLiftFile)
     bbList = quickLiftGetIntervals(quickLiftFile, bbi, chrom, ivStart, ivEnd, &chainHash);
 else
     bbList = bigBedIntervalQuery(bbi, chrom, ivStart, ivEnd, 0, lm);
 
 /* Get bedSize if it's not already defined. */
-if (bedSize == 0)
+if (bedSize != 0) // defined in trackDb
     {
-    bedSize = bbi->definedFieldCount;
+    // check to make sure trackDb number is the same as the number
+    // of defined fields
+    if (bedSize != bbi->definedFieldCount)
+        warn("trackDb for %s has type with %d bed fields but the bigBed file %s has %d bed fields. Fields may be printed with the wrong contents.", tdb->track, bedSize, fileName, bbi->definedFieldCount);
     }
 
+boolean bigBedOnePath = cfgOptionBooleanDefault("bigBedOnePath", FALSE);
+if (bigBedOnePath || (bedSize == 0))
+    bedSize = bbi->definedFieldCount;
+
 char *scoreFilter = cartOrTdbString(cart, tdb, "scoreFilter", NULL);
 int minScore = 0;
 if (scoreFilter)
     minScore = atoi(scoreFilter);
 
 /* Find particular item in list - matching start, and item if possible. */
 boolean found = FALSE;
 boolean firstTime = TRUE;
 struct bigBedInterval *bb;
 for (bb = bbList; bb != NULL; bb = bb->next)
     {
     if (bedSize > 3)
 	{
 	char *name = cloneFirstWordByDelimiterNoSkip(bb->rest, '\t');
 	boolean match = (isEmpty(name) && isEmpty(item)) || sameOk(name, item);