19de5d37d6012bd61b9c5a57fbc524581c7a1987
braney
  Tue Jan 18 15:25:13 2022 -0800
adding support for speciesLabels to hgTrackUi

diff --git src/hg/lib/hui.c src/hg/lib/hui.c
index d8e2a0f..f1d235c 100644
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@ -7449,30 +7449,31 @@
 slReverse(&wmSpeciesList);
 *list = wmSpeciesList;
 
 return groups;
 }
 
 
 struct wigMafSpecies * wigMafSpeciesTable(struct cart *cart,
                                           struct trackDb *tdb, char *name, char *db)
 {
 int groupCt;
 #define MAX_SP_SIZE 2000
 char option[MAX_SP_SIZE];
 int group, prevGroup;
 int i,j;
+struct hash *labelHash = mafGetLabelHash(tdb);
 
 bool lowerFirstChar = TRUE;
 
 struct wigMafSpecies *wmSpeciesList;
 char **groups = wigMafGetSpecies(cart, tdb, name, db, &wmSpeciesList, &groupCt);
 struct wigMafSpecies *wmSpecies = wmSpeciesList;
 struct slName *speciesList = NULL;
 
 for(; wmSpecies; wmSpecies = wmSpecies->next)
     {
     struct slName *newName = slNameNew(wmSpecies->name);
     slAddHead(&speciesList, newName);
     }
 slReverse(&speciesList);
 
@@ -7552,35 +7553,42 @@
         else
             {
             safef(id, sizeof(id), "cb_maf_%s_%s_defOff", groups[group], wmSpecies->name);
             }
         }
     else
         safef(id, sizeof(id), "cb_maf_%s_%s", groups[group], wmSpecies->name);
 
     puts("<TD>");
     boolean defaultState = TRUE;
     if (offHash != NULL)
         defaultState = (hashLookup(offHash, wmSpecies->name) == NULL);
     safecpy(option, sizeof(option), name);
     wmSpecies->on = isSpeciesOn(cart, tdb, wmSpecies->name, option, sizeof option, defaultState );
     cgiMakeCheckBoxWithId(option, wmSpecies->on,id);
+
+    char *remapName = NULL;
+    if ((labelHash != NULL) && (remapName = hashFindVal(labelHash,wmSpecies->name)))
+        label = remapName;
+    else
+        {
         label = hOrganism(wmSpecies->name);
         if (label == NULL)
                 label = wmSpecies->name;
         if (lowerFirstChar)
             *label = tolower(*label);
+        }
     printf("%s<BR>", label);
     puts("</TD>");
     lineBreakJustPrinted = FALSE;
     j++;
     }
 puts("</TR></TABLE><BR>\n");
 return wmSpeciesList;
 }
 
 void wigMafCfgUi(struct cart *cart, struct trackDb *tdb,char *name, char *title, boolean boxed, char *db)
 /* UI for maf/wiggle track
  * NOTE: calls wigCfgUi */
 {
 int i;
 char option[MAX_SP_SIZE];