430c6779758c85d2b47bf8ca986a518c195a6b07
kent
  Tue Feb 8 09:51:28 2011 -0800
Making link to table browser for hub tracks preload the hub track.
diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c
index df8601e..aeb8ddc 100644
--- src/hg/lib/hdb.c
+++ src/hg/lib/hdb.c
@@ -20,30 +20,31 @@
 #include "bed.h"
 #include "defaultDb.h"
 #include "scoredRef.h"
 #include "maf.h"
 #include "ra.h"
 #include "liftOver.h"
 #include "liftOverChain.h"
 #include "grp.h"
 #include "twoBit.h"
 #include "ra.h"
 #include "genbank.h"
 #include "chromInfo.h"
 #ifndef GBROWSE
 #include "axtInfo.h"
 #include "ctgPos.h"
+#include "hubConnect.h"
 #include "customTrack.h"
 #include "hgFind.h"
 #endif /* GBROWSE */
 #include "hui.h"
 
 static char const rcsid[] = "$Id: hdb.c,v 1.433 2010/05/21 16:39:57 angie Exp $";
 
 #ifdef LOWELAB
 #define DEFAULT_PROTEINS "proteins060115"
 #define DEFAULT_GENOME "Pyrobaculum aerophilum"
 #else
 #define DEFAULT_PROTEINS "proteins"
 #define DEFAULT_GENOME "Human"
 #endif
 
@@ -3668,34 +3669,42 @@
 hFreeConn(&conn);
 }
 
 struct trackDb *tdbForTrack(char *db, char *track,struct trackDb **tdbList)
 /* Load trackDb object for a track. If track is composite, its subtracks
  * will also be loaded and inheritance will be handled; if track is a
  * subtrack then inheritance will be handled.  (Unless a subtrack has
  * "noInherit on"...) This will die if the current database does not have
  * a trackDb, but will return NULL if track is not found.
  * MAY pass in prepopulated trackDb list, or may receive the trackDb list as an inout. */
 {
 /* Get track list .*/
 struct trackDb *theTdbs = NULL;
 if (tdbList == NULL || *tdbList == NULL)
     {
+    if (isHubTrack(track))
+        {
+	struct hash *hash = hashNew(0);
+	theTdbs = hubConnectAddHubForTrackAndFindTdb(db, track, tdbList, hash);
+	}
+    else
+	{
     theTdbs = hTrackDb(db);
     if (tdbList != NULL)
         *tdbList = theTdbs;
     }
+    }
 else
     theTdbs = *tdbList;
 return rFindTrack(0, theTdbs, track);
 }
 
 struct trackDb *hTrackDbForTrackAndAncestors(char *db, char *track)
 /* Load trackDb object for a track. If need be grab its ancestors too.
  * This does not load children. hTrackDbForTrack will handle children, and
  * is actually faster if being called on lots of tracks.  This function
  * though is faster on one or two tracks. */
 {
 struct sqlConnection *conn = hAllocConn(db);
 struct trackDb *tdb = loadTrackDbForTrack(conn, track);
 struct trackDb *ancestor = tdb;
 for (;;)