26e50fc73b51156c02e07d431aca5f0c2621108b
chmalee
  Wed Nov 3 13:48:27 2021 -0700
Allow barChartCategoryUrl in custom tracks and track hubs instead of barChartBars, refs #28442

diff --git src/hg/lib/customFactory.c src/hg/lib/customFactory.c
index 6e51372..86e4372 100644
--- src/hg/lib/customFactory.c
+++ src/hg/lib/customFactory.c
@@ -1264,34 +1264,37 @@
 int expScoresCount = chopCommas(cloneString(row[BARCHART_EXPSCORES_COLUMN_IX]), buf);
 int expCount = sqlUnsigned(row[BARCHART_EXPCOUNT_COLUMN_IX]);
 if (expCount != expScoresCount)
     lineFileAbort(lf, "type is %s, but found %d expScores (expecting %d)",
                 type, expScoresCount, expCount);
 return TRUE;
 }
 
 static void requireBarChartBars(struct customTrack *track)
 /* If barChart bars spec is empty, errAbort with helpful message */
 {
 struct hash *settings = track->tdb->settingsHash;
 char *barChartBars = hashFindVal(settings, BAR_CHART_CATEGORY_LABELS);
 if (isNotEmpty(barChartBars))
     return;
-errAbort("Missing '%s' setting from track of type=%s (%s).  "
+barChartBars = hashFindVal(settings, BAR_CHART_CATEGORY_URL);
+if (isNotEmpty(barChartBars))
+    return;
+errAbort("Missing either '%s' or '%s' setting from track of type=%s (%s).  "
          "Please check for case and spelling and that there is no new-line "
-         "between the 'track' and the '%s'.",
-         BAR_CHART_CATEGORY_LABELS, track->tdb->type, track->tdb->shortLabel, BAR_CHART_CATEGORY_LABELS);
+         "between the 'track' and the '%s' or '%s'.",
+         BAR_CHART_CATEGORY_LABELS, BAR_CHART_CATEGORY_URL, track->tdb->type, track->tdb->shortLabel, BAR_CHART_CATEGORY_LABELS, BAR_CHART_CATEGORY_URL);
 }
 
 static boolean barChartRecognizer(struct customFactory *fac, struct customPp *cpp, char *type,
                                         struct customTrack *track)
 /* Return TRUE if looks like we're handling a barChart track */
 {
 // type is required
 if (type == NULL || !sameType(type, fac->name))
     return FALSE;
 char *line = customFactoryNextRealTilTrack(cpp);
 if (line == NULL)
     return FALSE;
 char *dupe = cloneString(line);
 char *row[BARCHARTBED_NUM_COLS+1];
 int wordCount = chopLine(dupe, row);