88c3b3d8ed217d673a1879972d488f2303ea72f3
hiram
  Wed Jun 22 15:53:12 2011 -0700
properly recognize custom tracks, and allow close of bigWig files after load time
diff --git src/hg/hgTracks/bedGraph.c src/hg/hgTracks/bedGraph.c
index 82e04b7..5fc7d51 100644
--- src/hg/hgTracks/bedGraph.c
+++ src/hg/hgTracks/bedGraph.c
@@ -23,59 +23,59 @@
  *	All these names were condensed into the root of the name with
  *	the extensions removed.
  */
 static char *bedGraphName(struct track *tg, void *item)
 /* Return name of bedGraph level track. */
 {
 struct bedGraphItem *bg = item;
 return bg->name;
 }
 
 void ctBedGraphLoadItems(struct track *tg)
 {
 /*	load custom bedGraph track data	*/
 
 /*	Verify this is a custom track	*/
-if (tg->customPt == (void *)NULL)
+if (! (isCustomTrack(tg->table) && tg->customPt))
     errAbort("ctBedGraphLoadItems: did not find a custom wiggle track: %s", tg->track);
 
 errAbort("custom track bedGraph load items not yet implemented");
 }
 
 /*	bedGraphLoadItems - an ordinary bed load, but we are interested
  *		in only the chrom, start, end, and the graphColumn
  */
 static void bedGraphLoadItems(struct track *tg)
 {
 struct sqlConnection *conn;
 struct sqlResult *sr = (struct sqlResult *) NULL;
 char **row = (char **)NULL;
 int rowOffset = 0;
 struct bedGraphItem *bgList = NULL;
 int itemsLoaded = 0;
 int colCount = 0;
 struct wigCartOptions *wigCart = (struct wigCartOptions *) tg->extraUiData;
 int graphColumn = 5;
 char *tableName;
 
 if(sameString(tg->table, "affyTranscription"))
     wigCart->colorTrack = "affyTransfrags";
 graphColumn = wigCart->graphColumn;
 
 
 #ifndef GBROWSE
-if (tg->customPt)
+if (isCustomTrack(tg->table) && tg->customPt)
     {
     struct customTrack *ct = (struct customTrack *) tg->customPt;
     tableName = ct->dbTableName;
     conn = hAllocConn(CUSTOM_TRASH);
     }
 else 
 #endif /* GBROWSE */
     {
     tableName = tg->table;
     conn = hAllocConnTrack(database, tg->tdb);
     }
 
 sr = hRangeQuery(conn, tableName, chromName, winStart, winEnd, NULL,
 	&rowOffset);