d611f39a00ac8d8a6385834aa1b2ea8dbe65d574
markd
  Thu May 25 15:26:39 2017 -0700
fixed bug in gencode highlight code where no highlights specified results in all being highlights

diff --git src/hg/hgTracks/gencodeTracks.c src/hg/hgTracks/gencodeTracks.c
index e844508..29459aff 100644
--- src/hg/hgTracks/gencodeTracks.c
+++ src/hg/hgTracks/gencodeTracks.c
@@ -55,30 +55,45 @@
 
 static void gencodeQueryBeginSubWhere(struct gencodeQuery *gencodeQuery)
 /* begin adding new where sub-clause */
 {
 if (dyStringLen(gencodeQuery->where) > 0)
     dyStringAppend(gencodeQuery->where, " and ");
 dyStringAppend(gencodeQuery->where, "(");
 }
 
 static void gencodeQueryEndSubWhere(struct gencodeQuery *gencodeQuery)
 /* finish adding new where sub-clause */
 {
 dyStringAppend(gencodeQuery->where, ")");
 }
 
+static boolean anyFilterBy(struct track *tg, filterBySetGetFuncType filterBySetGetFunc)
+/* check if any filters were specified of the particular type */
+{
+filterBy_t *filterBySet = filterBySetGetFunc(tg->tdb, cart, NULL);
+filterBy_t *filterBy;
+boolean someFilters = FALSE;
+for (filterBy = filterBySet; (filterBy != NULL) && !someFilters; filterBy = filterBy->next)
+    {
+    if (!filterByAllChosen(filterBy))
+        someFilters = TRUE;
+    }   
+filterBySetFree(&filterBySet);
+return someFilters;
+}
+
 static char *tslSymToNumStr(char *tslSym)
 /* convert a transcription support level string (tsl1..tsl5, tslN), to 
  * a numeric string ("1".."5", "-1") */
 {
 if (sameString(tslSym, "tslNA"))
     return "-1";
 else
     return tslSym+3;
 }
 
 static void filterByMethodChoiceQuery(char *choice, struct gencodeQuery *gencodeQuery)
 /* add SQL expression GENCODE transcript method choice. */
 {
 /*
  * example sources and categories:
@@ -337,39 +352,42 @@
 struct sqlResult *sr = executeQuery(conn, gencodeQuery);
 char **row;
 while ((row = sqlNextRow(sr)) != NULL)
     hashAddInt(highlightIds, row[0], 1);
 sqlFreeResult(&sr);
 return highlightIds;
 }
 
 
 static struct linkedFeatures *loadGencodeGenePred(struct track *tg, struct gencodeQuery *gencodeQuery, char **row,
                                                   struct hash *highlightIds, unsigned highlightColor)
 /* load one genePred record into a linkedFeatures object */
 {
 struct genePred *gp = genePredExtLoad(row, (gencodeQuery->isGenePredX ? GENEPREDX_NUM_COLS:  GENEPRED_NUM_COLS));
 struct linkedFeatures *lf = linkedFeaturesFromGenePred(tg, gp, TRUE);
+if (highlightIds != NULL)
     highlightByGetColor(gp, highlightIds, highlightColor, lf);
 return lf;
 }
 
 static void loadGencodeGenePreds(struct track *tg)
 /* Load genePreds in window info linked feature, with filtering, etc. */
 {
 struct sqlConnection *conn = hAllocConn(database);
-struct hash *highlightIds = loadHighlightIds(conn, tg);
+struct hash *highlightIds = NULL;
+if (anyFilterBy(tg, highlightBySetGet))
+    highlightIds = loadHighlightIds(conn, tg);
 struct gencodeQuery *gencodeQuery = geneQueryConstruct(tg);
 struct sqlResult *sr = executeQuery(conn, gencodeQuery);
 struct linkedFeatures *lfList = NULL;
 unsigned highlightColor = getHighlightColor(tg);
 char **row;
 while ((row = sqlNextRow(sr)) != NULL)
     slAddHead(&lfList, loadGencodeGenePred(tg, gencodeQuery, row, highlightIds, highlightColor));
 sqlFreeResult(&sr);
 hFreeConn(&conn);
 
 if (tg->visibility != tvDense)
     slSort(&lfList, linkedFeaturesCmpStart);
 else
     slReverse(&lfList);
 tg->items = lfList;