c27f107d9a15644686441d609f03c40d0c856663 angie Fri Mar 2 10:19:31 2012 -0800 All pgSnp tables have a bin column, but loadPgSnp was not usinghAddBinToQuery to take advantage of it. It makes a difference when viewing a 1Mb region. diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index c34f509..de47432 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -9657,43 +9657,45 @@ f = f*2; t = t*2; } return tgFixedTotalHeightOptionalOverflow(tg,vis, t, f, FALSE); } void freePgSnp(struct track *tg) /* Free pgSnp items. */ { pgSnpFreeList(((struct pgSnp **)(&tg->items))); } void loadPgSnp(struct track *tg) /* Load up pgSnp (personal genome SNP) type tracks */ { -char query[256]; struct customTrack *ct = tg->customPt; char *table = tg->table; struct sqlConnection *conn; if (ct == NULL) conn = hAllocConn(database); else { conn = hAllocConn(CUSTOM_TRASH); table = ct->dbTableName; } -safef(query, sizeof(query), "select * from %s where chrom = '%s' and chromStart < %d and chromEnd > %d", table, chromName, winEnd, winStart); -tg->items = pgSnpLoadByQuery(conn, query); +struct dyString *query = dyStringCreate("select * from %s where ", table); +hAddBinToQuery(winStart, winEnd, query); +dyStringPrintf(query, "chrom = '%s' and chromStart < %d and chromEnd > %d", + chromName, winEnd, winStart); +tg->items = pgSnpLoadByQuery(conn, query->string); /* base coloring/display decision on count of items */ tg->customInt = slCount(tg->items); hFreeConn(&conn); } void pgSnpMapItem(struct track *tg, struct hvGfx *hvg, void *item, char *itemName, char *mapItemName, int start, int end, int x, int y, int width, int height) /* create a special map box item with different * pop-up statusLine with allele counts */ { char *directUrl = trackDbSetting(tg->tdb, "directUrl"); boolean withHgsid = (trackDbSetting(tg->tdb, "hgsid") != NULL); struct pgSnp *el = item; char *nameCopy = cloneString(itemName); /* so chopper doesn't mess original */