957f2123050742982ef6c7aefcab70d29144924c
braney
  Mon Oct 9 17:49:04 2017 -0700
allow bedGraph. Change names in collections so they don't match names in
trackDb, move the copying of custom tracks and collections to BEFORE the
load of trackHubs, misc other bugs

diff --git src/hg/hgTracks/bedGraph.c src/hg/hgTracks/bedGraph.c
index d53a51b..4df6942 100644
--- src/hg/hgTracks/bedGraph.c
+++ src/hg/hgTracks/bedGraph.c
@@ -59,30 +59,36 @@
 int graphColumn = 5;
 char *tableName;
 
 if(sameString(tg->table, "affyTranscription"))
     wigCart->colorTrack = "affyTransfrags";
 graphColumn = wigCart->graphColumn;
 
 
 #ifndef GBROWSE
 if (isCustomTrack(tg->table) && tg->customPt)
     {
     struct customTrack *ct = (struct customTrack *) tg->customPt;
     tableName = ct->dbTableName;
     conn = hAllocConn(CUSTOM_TRASH);
     }
+else if (isCustomTrack(tg->table) )
+    {
+    // we can get custom tracks through track hubs that don't have customPt
+    conn = hAllocConn(CUSTOM_TRASH);
+    tableName = trackDbSetting(tg->tdb, "dbTableName");
+    }
 else 
 #endif /* GBROWSE */
     {
     tableName = tg->table;
     conn = hAllocConnTrack(database, tg->tdb);
     }
 
 sr = hRangeQuery(conn, tableName, chromName, winStart, winEnd, NULL,
 	&rowOffset);
 
 colCount = sqlCountColumns(sr) - rowOffset;
 /*	Must have at least four good columns	*/
 if (colCount < 4)
     errAbort("bedGraphLoadItems: table %s only has %d data columns, must be at least 4", tableName, colCount);