src/hg/hgTracks/bigWigTrack.c 1.7

1.7 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/bigWigTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/bigWigTrack.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -b -B -U 4 -r1.6 -r1.7
--- src/hg/hgTracks/bigWigTrack.c	24 Jun 2009 18:48:00 -0000	1.6
+++ src/hg/hgTracks/bigWigTrack.c	10 Nov 2009 05:48:17 -0000	1.7
@@ -27,10 +27,9 @@
 /* Get summary info from bigWig */
 int summarySize = width;
 struct bbiSummaryElement *summary;
 AllocArray(summary, summarySize);
-char *wigFileName = tg->bbiFileName;
-if (bigWigSummaryArrayExtended(wigFileName, chromName, winStart, winEnd, summarySize, summary))
+if (bigWigSummaryArrayExtended(tg->bbiFile, chromName, winStart, winEnd, summarySize, summary))
     {
     /* Convert format to predraw */
     int i;
     for (i=0; i<summarySize; ++i)
@@ -55,13 +54,14 @@
 
 static void bigWigLoadItems(struct track *tg)
 /* Fill up tg->items with bedGraphItems derived from a bigWig file */
 {
-if (tg->bbiFileName == NULL)
+if (tg->bbiFile == NULL)
     {
     /* Figure out bigWig file name. */
     struct sqlConnection *conn = hAllocConn(database);
-    tg->bbiFileName = bbiNameFromTable(conn, tg->mapName);
+    char *fileName = bbiNameFromTable(conn, tg->mapName);
+    tg->bbiFile = bigWigFileOpen(fileName);
     hFreeConn(&conn);
     }
 }