77da195bc4b0f335574943a2daca3afd4677e8b8 braney Fri Apr 26 14:47:29 2013 -0700 libify the connection to all the hubs by request of Angie. diff --git src/hg/hgTables/hgTables.c src/hg/hgTables/hgTables.c index e64f916..6080d44 100644 --- src/hg/hgTables/hgTables.c +++ src/hg/hgTables/hgTables.c @@ -245,44 +245,31 @@ void dbOverrideFromTable(char buf[256], char **pDb, char **pTable) /* If *pTable includes database, overrider *pDb with it, using * buf to hold string. */ { char *s; safef(buf, 256, "%s", *pTable); s = strchr(buf, '.'); if (s != NULL) { *pDb = buf; *s++ = 0; *pTable = s; } } -struct grp *grpFromHub(struct hubConnectStatus *hub) -/* Make up a grp structur from hub */ -{ -struct grp *grp; -AllocVar(grp); -char name[16]; -safef(name, sizeof(name), "hub_%d", hub->id); -grp->name = cloneString(name); -grp->label = cloneString(hub->trackHub->shortLabel); -return grp; -} - -static struct trackDb *getFullTrackList(struct hubConnectStatus *hubList, struct grp **pHubGroups) -/* Get all tracks including custom tracks if any. */ +static struct trackDb *getFullTrackList(struct grp **pHubGroups) { struct trackDb *list = hTrackDb(database); struct customTrack *ctList, *ct; /* exclude any track with a 'tableBrowser off' setting */ struct trackDb *tdb, *nextTdb, *newList = NULL; for (tdb = list; tdb != NULL; tdb = nextTdb) { nextTdb = tdb->next; if (tdbIsDownloadsOnly(tdb) || tdb->table == NULL) { //freeMem(tdb); // should not free tdb's. // While hdb.c should and says it does cache the tdbList, it doesn't. // The most notable reason that the tdbs are not cached is this hgTables CGI !!! // It needs to be rewritten to make tdbRef structures for the lists it creates here! @@ -290,67 +277,33 @@ } char *tbOff = trackDbSetting(tdb, "tableBrowser"); if (tbOff != NULL && startsWithWord("off", tbOff)) slAddHead(&forbiddenTrackList, tdb); else slAddHead(&newList, tdb); } slReverse(&newList); list = newList; /* add wikiTrack if enabled */ if (wikiTrackEnabled(database, NULL)) wikiTrackDb(&list); -/* Add hub tracks. */ -struct hubConnectStatus *hubStatus; -for (hubStatus = hubList; hubStatus != NULL; hubStatus = hubStatus->next) - { - /* Load trackDb.ra file and make it into proper trackDb tree */ - char hubName[64]; - safef(hubName, sizeof(hubName), "hub_%d", hubStatus->id); - - struct trackHub *hub = hubStatus->trackHub; - if (hub != NULL) - { - hub->name = cloneString(hubName); - struct trackHubGenome *hubGenome = trackHubFindGenome(hub, database); - if (hubGenome != NULL) - { - struct trackDb *tdbList = trackHubTracksForGenome(hub, hubGenome); - tdbList = trackDbLinkUpGenerations(tdbList); - tdbList = trackDbPolishAfterLinkup(tdbList, database); - trackDbPrioritizeContainerItems(tdbList); - if (tdbList != NULL) - { +struct trackHub *hubList = NULL; +struct trackDb *tdbList = hubCollectTracks(database, &hubList, pHubGroups); list = slCat(list, tdbList); - // we don't add the hub group if the database - // is a assembly hub since they have their own groups - if (!trackHubDatabase(database)) - { - struct grp *grp = grpFromHub(hubStatus); - slAddHead(pHubGroups, grp); - } - } - } - - // clear this so it isn't free'd later - hubStatus->trackHub = NULL; - } - } -slReverse(pHubGroups); /* Create dummy group for custom tracks if any. Add custom tracks to list */ ctList = getCustomTracks(); for (ct = ctList; ct != NULL; ct = ct->next) { slAddHead(&list, ct->tdb); } return list; } boolean fullGenomeRegion() /* Return TRUE if region is full genome. */ { char *regionType = cartUsualString(cart, hgtaRegionType, "genome"); @@ -1960,33 +1913,32 @@ { struct hash *hash = hashNew(0); struct trackDb *tdb; for (tdb = tdbList; tdb != NULL; tdb = tdb->next) { hashAdd(hash, tdb->track, tdb); } return hash; } void initGroupsTracksTables() /* Get list of groups that actually have something in them, prepare hashes * containing all tracks and all tables. Set global variables that correspond * to the group, track, and table specified in the cart. */ { -struct hubConnectStatus *hubList = hubConnectGetHubs(); struct grp *hubGrpList = NULL; -fullTrackList = getFullTrackList(hubList, &hubGrpList); +fullTrackList = getFullTrackList( &hubGrpList); fullTrackHash = hashTrackList(fullTrackList); fullTableToTdbHash = hashNew(0); rAddTablesToHash(fullTrackList, fullTableToTdbHash); curTrack = findSelectedTrack(fullTrackList, NULL, hgtaTrack); fullGroupList = makeGroupList(fullTrackList, &hubGrpList, allowAllTables()); curGroup = findSelectedGroup(fullGroupList, hgtaGroup); if (sameString(curGroup->name, "allTables")) curTrack = NULL; curTable = findSelectedTable(curTrack, hgtaTable); if (curTrack == NULL) { struct trackDb *tdb = hTrackDbForTrack(database, curTable); struct trackDb *cTdb = hCompositeTrackDbForSubtrack(database, tdb); if (cTdb) curTrack = cTdb;