49ba5b9081440aaf210605cf61c748aff9a6ddc7 braney Fri Nov 6 14:47:15 2015 -0800 a very basic instrumentation of UDC (no redmine) diff --git src/hg/hgTracks/wigMafTrack.c src/hg/hgTracks/wigMafTrack.c index 6a1f19e..490628e 100644 --- src/hg/hgTracks/wigMafTrack.c +++ src/hg/hgTracks/wigMafTrack.c @@ -292,31 +292,34 @@ /* load mafs in region to track custom pointer */ { struct sqlConnection *conn; struct sqlConnection *conn2; struct mafPriv *mp = getMafPriv(track); if (inSummaryMode(cart, track->tdb, winBaseCount)) return; int begin = winStart - 2; if (begin < 0) begin = 0; if (track->isBigBed) { - mp->list = bigMafLoadInRegion(fetchBbiForTrack(track), chromName, begin, winEnd+2); + struct bbiFile *bbi = fetchBbiForTrack(track); + mp->list = bigMafLoadInRegion(bbi, chromName, begin, winEnd+2); + bbiFileClose(&bbi); + track->bbiFile = NULL; } else if (mp->ct) { /* we open two connections to the database * that has the maf track in it. One is * for the scoredRefs, the other to access * the extFile database. We could get away * with just one connection, but then we'd * have to allocate more memory to hold * the scoredRefs (whereas now we just use * one statically loaded scoredRef). */ char *fileName = getCustomMafFile(track); @@ -505,31 +508,34 @@ char *snpTable = trackDbSetting(track->tdb, "snpTable"); boolean doSnpTable = FALSE; if ( (track->limitedVis == tvPack) && (snpTable != NULL) && cartOrTdbBoolean(cart, track->tdb, MAF_SHOW_SNP,FALSE)) doSnpTable = TRUE; // the maf's only get loaded if we're not in summary or snpTable views if (!doSnpTable && !inSummaryMode(cart, track->tdb, winBaseCount)) { /* "close in" display uses actual alignments from file */ struct mafPriv *mp = getMafPriv(track); struct sqlConnection *conn, *conn2; if (track->isBigBed) { + struct bbiFile *bbi = fetchBbiForTrack(track); mp->list = bigMafLoadInRegion(fetchBbiForTrack(track), chromName, winStart, winEnd); + bbiFileClose(&bbi); + track->bbiFile = NULL; } else if (mp->ct) { char *fileName = getCustomMafFile(track); conn = hAllocConn(CUSTOM_TRASH); conn2 = hAllocConn(CUSTOM_TRASH); mp->list = wigMafLoadInRegion(conn, conn2, mp->ct->dbTableName, chromName, winStart, winEnd, fileName); hFreeConn(&conn); hFreeConn(&conn2); } else { char *fileName = getTrackMafFile(track); // optional conn = hAllocConn(database); @@ -1168,30 +1174,31 @@ char *fileName = trackDbSetting(track->tdb, "summary"); struct bbiFile *bbi = bigBedFileOpen(fileName); struct bigBedInterval *bb, *bbList = bigBedIntervalQuery(bbi, chromName, seqStart, seqEnd, 0, lm); char *bedRow[7]; char startBuf[16], endBuf[16]; for (bb = bbList; bb != NULL; bb = bb->next) { bigBedIntervalToRow(bb, chromName, startBuf, endBuf, bedRow, ArraySize(bedRow)); ms = mafSummaryLoad(bedRow); if ((hel = hashLookup(componentHash, ms->src)) == NULL) hashAdd(componentHash, ms->src, ms); else slAddHead(&(hel->val), ms); } + bbiFileClose(&bbi); } else { /* Create SQL where clause that will load up just the * summaries for the species that we are including. */ conn = hAllocConn(database); dyStringAppend(where, "src in ("); for (mi = miList; mi != NULL; mi = mi->next) { if (!isPairwiseItem(mi)) /* exclude non-species items (e.g. conservation wiggle */ continue; dyStringPrintf(where, "'%s'", mi->db); if (mi->next != NULL) dyStringAppend(where, ","); @@ -1892,30 +1899,31 @@ { struct lm *lm = lmInit(0); struct bbiFile *bbi = bigBedFileOpen(framesTable); struct bigBedInterval *bb, *bbList = bigBedIntervalQuery(bbi, chromName, seqStart, seqEnd, 0, lm); char *bedRow[11]; char startBuf[16], endBuf[16]; struct mafFrames *mfList = NULL, *mf; for (bb = bbList; bb != NULL; bb = bb->next) { bigBedIntervalToRow(bb, chromName, startBuf, endBuf, bedRow, ArraySize(bedRow)); mf = mafFramesLoad( bedRow ); slAddHead(&mfList, mf); } +bbiFileClose(&bbi); slReverse(&mfList); return mfList; } static int wigMafDrawBases(struct track *track, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont *font, Color color, enum trackVisibility vis, struct wigMafItem *miList) /* Draw base-by-base view, return new Y offset. */ { struct wigMafItem *mi; struct mafAli *mafList, *maf, *sub; struct mafComp *mc, *mcMaster; int lineCount = slCount(miList); char **lines = NULL, *selfLine;