13598ccea89fe2434ea2be5aa8b9077619ceabe4
braney
  Sat Feb 4 08:44:35 2017 -0800
fix some problems with big* labels

diff --git src/hg/lib/hui.c src/hg/lib/hui.c
index 8fbe16e..8c609f5 100644
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@ -5803,37 +5803,41 @@
 
 void labelCfgUi(char *db, struct cart *cart, struct trackDb *tdb)
 /* If there is a labelFields for a bigBed, this routine is called to put up the label options. */
 {
 char *labelFields = trackDbSettingClosestToHome(tdb, "labelFields");
 if (labelFields == NULL)
     return;
 
 struct slName *thisLabel, *labelIds = slNameListFromComma(labelFields);
 struct asObject *as = asForDb(tdb, db);  
 char varName[1024];
 
 printf("<B>Label:</B> ");
 for(thisLabel = labelIds; thisLabel; thisLabel = thisLabel->next)
     {
-    struct asColumn *col = asColumnFind(as, thisLabel->name);
+    char *trimLabel = trimSpaces(thisLabel->name);
+    struct asColumn *col = asColumnFind(as, trimLabel);
 
-    safef(varName, sizeof(varName), "%s.label.%s", tdb->track, thisLabel->name);
+    if (col == NULL)
+        errAbort("cannot find field named '%s' in as file '%s'",
+            trimLabel, as->name);
+
+    safef(varName, sizeof(varName), "%s.label.%s", tdb->track, trimLabel);
     boolean option = cartUsualBoolean(cart, varName, thisLabel==labelIds);
     cgiMakeCheckBox(varName, option);
     printf(" %s&nbsp;&nbsp;&nbsp;", col->comment);
-
     }
 }
 
 void pslCfgUi(char *db, struct cart *cart, struct trackDb *tdb, char *name, char *title,
               boolean boxed)
 /* Put up UI for psl tracks */
 {
 boxed = cfgBeginBoxAndTitle(tdb, boxed, title);
 
 char *typeLine = cloneString(tdb->type);
 char *words[8];
 int wordCount = wordCount = chopLine(typeLine, words);
 if (sameString(tdb->type, "bigPsl"))
     labelCfgUi(db, cart, tdb);
 if (wordCount == 3 && sameWord(words[1], "xeno"))