6dcef0d057b21be3cb1cbe699998764883543c84
kate
  Thu Apr 6 16:46:22 2017 -0700
First cut bigBarChart track type for hubs. Basic function on hgTracks, hgTrackUi, and hgc.  Lacks boxplot on details page, custom track support, extra fields

diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index da4c350..729b53c 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -7780,30 +7780,31 @@
     float realScore = (float)(bed->score - scoreMin) / (scoreMax - scoreMin);
     bed->score = newScoreMin + (realScore * (scoreMax - newScoreMin)) + 0.5;
     }
 else if (scoreMin != 0 && scoreMax == 1000) // Changes gray level even when
     {                                       // UI does not allow selecting it.
     float realScore = (float)(bed->score) / 1000;
     bed->score = scoreMin + (realScore * (scoreMax - scoreMin)) + 0.5;
     }
 }
 
 static void bedLoadItemByQueryWhere(struct track *tg, char *table, char *query,
                                 char *extraWhere, ItemLoader loader)
 /* Generic itg->item loader, adding extra clause to hgRangeQuery if query is NULL
  * and extraWhere is not NULL */
 {
+// KATE TODO: Add bigBed query ?
 struct sqlConnection *conn = hAllocConn(database);
 int rowOffset = 0;
 struct sqlResult *sr = NULL;
 char **row = NULL;
 struct slList *itemList = NULL, *item = NULL;
 
 if (query == NULL)
     sr = hRangeQuery(conn, table, chromName,
 		     winStart, winEnd, extraWhere, &rowOffset);
 else
     sr = sqlGetResult(conn, query);
 
 while ((row = sqlNextRow(sr)) != NULL)
     {
     item = loader(row + rowOffset);
@@ -7821,31 +7822,30 @@
 bedLoadItemByQueryWhere(tg, table, NULL, extraWhere, loader);
 }
 
 void bedLoadItemByQuery(struct track *tg, char *table, char *query, ItemLoader loader)
 /* Generic tg->item loader. If query is NULL use generic hRangeQuery(). */
 {
 bedLoadItemByQueryWhere(tg, table, query, NULL, loader);
 }
 
 void bedLoadItem(struct track *tg, char *table, ItemLoader loader)
 /* Generic tg->item loader. */
 {
 bedLoadItemByQuery(tg, table, NULL, loader);
 }
 
-
 void atomDrawSimpleAt(struct track *tg, void *item,
                       struct hvGfx *hvg, int xOff, int y,
                       double scale, MgFont *font, Color color, enum trackVisibility vis)
 /* Draw a single simple bed item at position. */
 {
 struct bed *bed = item;
 int heightPer = tg->heightPer;
 int x1 = round((double)((int)bed->chromStart-winStart)*scale) + xOff;
 int x2 = round((double)((int)bed->chromEnd-winStart)*scale) + xOff;
 int w;
 struct trackDb *tdb = tg->tdb;
 int scoreMin = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMin", "0"));
 int scoreMax = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMax", "1000"));
 char *directUrl = trackDbSetting(tdb, "directUrl");
 boolean withHgsid = (trackDbSetting(tdb, "hgsid") != NULL);
@@ -13812,30 +13812,36 @@
     {
     bigBedMethods(track, tdb, wordCount, words);
     if (trackShouldUseAjaxRetrieval(track))
         track->loadItems = dontLoadItems;
     }
 else if (sameWord(type, "bigMaf"))
     {
     tdb->canPack = TRUE;
     wordCount++;
     words[1] = "3";
     wigMafMethods(track, tdb, wordCount, words);
     track->isBigBed = TRUE;
     if (trackShouldUseAjaxRetrieval(track))
         track->loadItems = dontLoadItems;
     }
+else if (sameWord(type, "bigBarChart"))
+    {
+    tdb->canPack = TRUE;
+    track->isBigBed = TRUE;
+    barChartMethods(track);
+    }
 else if (sameWord(type, "bigPsl"))
     {
     tdb->canPack = TRUE;
     wordCount++;
     words[1] = "12";
     bigBedMethods(track, tdb, wordCount, words);
     if (trackShouldUseAjaxRetrieval(track))
         track->loadItems = dontLoadItems;
     }
 else if (sameWord(type, "bigChain"))
     {
     tdb->canPack = TRUE;
     wordCount++;
     words[1] = "11";
     track->isBigBed = TRUE;