f3e2a9eb74858d409ad94350c64496a09561e26f
kent
  Thu Jan 13 21:32:06 2011 -0800
Starting to work on getting bigBeds from data hubs to work with table browser.  Still a ways to go though.
diff --git src/hg/hgTables/hgTables.c src/hg/hgTables/hgTables.c
index aa41e22..591b585 100644
--- src/hg/hgTables/hgTables.c
+++ src/hg/hgTables/hgTables.c
@@ -573,56 +573,63 @@
 }
 
 void checkTableExists(struct sqlConnection *conn, char *table)
 /* Check that table exists, or put up an error message. */
 {
 char *splitTable = chromTable(conn, table);
 if (!sqlTableExists(conn, table))
     errAbort("Table %s doesn't exist", table);
 freeMem(splitTable);
 }
 
 struct hTableInfo *hubTrackTableInfo(struct trackDb *tdb)
 /* Given trackDb entry for a hub track, wrap table info around it. */
 {
 struct hTableInfo *hti;
+if (startsWithWord("bigBed", tdb->type))
+    {
+    hti = bigBedToHti(tdb->track, NULL);
+    }
+else
+    {
 AllocVar(hti);
 hti->rootName = cloneString(tdb->track);
 hti->isPos = TRUE;
 hti->type = cloneString(tdb->type);
+    }
 return hti;
 }
 
 struct hTableInfo *maybeGetHti(char *db, char *table, struct sqlConnection *conn)
 /* Return primary table info, but don't abort if table not there. Conn should be open to db. */
 {
 struct hTableInfo *hti = NULL;
 
-if (hIsBigBed(database, table, curTrack, ctLookupName))
+if (isHubTrack(table))
+    {
+    struct trackDb *tdb = hashMustFindVal(fullTrackAndSubtrackHash, table);
+    hti = hubTrackTableInfo(tdb);
+    }
+else if (hIsBigBed(database, table, curTrack, ctLookupName))
     {
     hti = bigBedToHti(table, conn);
     }
 else if (isCustomTrack(table))
     {
     struct customTrack *ct = ctLookupName(table);
     hti = ctToHti(ct);
     }
-else if (isHubTrack(table))
-    {
-    struct trackDb *tdb = hashMustFindVal(fullTrackAndSubtrackHash, table);
-    hti = hubTrackTableInfo(tdb);
-    }
 else if (sameWord(table, WIKI_TRACK_TABLE))
     {
     hti = wikiHti();
     }
 else
     {
     char *track;
     if (startsWith("chrN_", table))
 	track = table + strlen("chrN_");
     else
 	track = table;
     hti = hFindTableInfo(db, NULL, track);
     }
 return(hti);
 }