src/hg/hgTracks/hgTracks.c 1.1604
1.1604 2009/11/10 05:48:17 kent
Changing bbiFileName field in track to bbiFile, so that it is kept open rather than repeatedly opened and closed. This avoids round trips to remote servers. Also starting to put in some stuff for tracks hosted on remote MySQL servers, though this is not complete.
Index: src/hg/hgTracks/hgTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/hgTracks.c,v
retrieving revision 1.1603
retrieving revision 1.1604
diff -b -B -U 4 -r1.1603 -r1.1604
--- src/hg/hgTracks/hgTracks.c 1 Nov 2009 21:24:15 -0000 1.1603
+++ src/hg/hgTracks/hgTracks.c 10 Nov 2009 05:48:17 -0000 1.1604
@@ -30,8 +30,9 @@
#include "wikiTrack.h"
#include "ctgPos.h"
#include "bed.h"
#include "bigBed.h"
+#include "bigWig.h"
#include "bedCart.h"
#include "customTrack.h"
#include "cytoBand.h"
#include "ensFace.h"
@@ -2497,8 +2498,23 @@
}
hashElFreeList(&hels);
}
+struct sqlConnection *remoteTrackConnection(struct track *tg)
+/* Get a connection to remote database as specified in remoteSql settings... */
+{
+if (!tg->isRemoteSql)
+ {
+ internalErr();
+ return NULL;
+ }
+else
+ {
+ return sqlConnectRemote(tg->remoteSqlHost, tg->remoteSqlUser, tg->remoteSqlPassword,
+ tg->remoteSqlDatabase);
+ }
+}
+
void loadFromTrackDb(struct track **pTrackList)
/* Load tracks from database, consulting handler list. */
{
struct trackDb *tdb, *tdbList = NULL;
@@ -2867,28 +2882,24 @@
}
else if (sameString(type, "bigWig"))
{
tg = trackFromTrackDb(tdb);
- tg->bbiFileName = trackDbSetting(tdb, "bigDataUrl");
+ tg->bbiFile = ct->bbiFile;
tg->nextItemButtonable = FALSE;
}
else if (sameString(type, "bigBed"))
{
- /* Figure out file name from settings. */
- char *fileName = trackDbSetting(tdb, "bigDataUrl");
+ struct bbiFile *bbi = ct->bbiFile;
- /* Briefly open file to find field counts, and from that revise the
- * tdb->type to be more complete. */
- struct bbiFile *bbi = bigBedFileOpen(fileName);
+ /* Find field counts, and from that revise the tdb->type to be more complete. */
char extra = (bbi->fieldCount > bbi->definedFieldCount ? '+' : '.');
char typeBuf[64];
safef(typeBuf, sizeof(typeBuf), "bigBed %d %c", bbi->definedFieldCount, extra);
tdb->type = cloneString(typeBuf);
- bbiFileClose(&bbi);
/* Finish wrapping track around tdb. */
tg = trackFromTrackDb(tdb);
- tg->bbiFileName = fileName;
+ tg->bbiFile = bbi;
tg->nextItemButtonable = FALSE;
}
else if (sameString(type, "bedGraph"))
{
@@ -3759,8 +3770,10 @@
if (!parent || sameString(parentShow, "show"))
compositeTrackVis(track);
}
}
+if (measureTiming)
+ uglyTime("getTrackList");
return trackList;
}
void doNextPrevItem(boolean goNext, char *trackName)
@@ -3976,10 +3989,12 @@
hideControls = cartUsualBoolean(cart, "hideControls", FALSE);
if (measureTiming)
uglyTime("Time before getTrackList");
trackList = getTrackList(&groupList, defaultTracks ? -1 : -2);
+#ifdef SOON
if (measureTiming)
uglyTime("getTrackList");
+#endif /* SOON */
/* Honor hideAll and visAll variables */
if (hideAll || defaultTracks)
{