From 3275e4558c454cc27dbe21f0397ee8c1e4b2e8e7 Mon Sep 17 00:00:00 2001 From: Kanwei Li Date: Fri, 13 May 2011 16:49:43 -0400 Subject: [PATCH] trackster: tweak resolution, fix LineTrack data bug --- lib/galaxy/visualization/tracks/data_providers.py | 5 +++-- static/scripts/trackster.js | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/visualization/tracks/data_providers.py b/lib/galaxy/visualization/tracks/data_providers.py index 1c8638406cd..d5a3fd1bded 100644 --- a/lib/galaxy/visualization/tracks/data_providers.py +++ b/lib/galaxy/visualization/tracks/data_providers.py @@ -332,10 +332,11 @@ class BBIDataProvider( TracksDataProvider ): # The first zoom level for BBI files is 640. If too much is requested, it will look at each block instead # of summaries. The calculation done is: zoom <> (end-start)/num_points/2. # Thus, the optimal number of points is (end-start)/num_points/2 = 640 - # num_points = (end-start) / 1280 + # num_points = (end-start) / 1280 num_points = (end-start) / 1280 - if (end - start) < num_points: + if num_points < 1: num_points = end - start + num_points = max(num_points, 10) data = bbi.query(chrom, start, end, num_points) f.close() diff --git a/static/scripts/trackster.js b/static/scripts/trackster.js index d381592a5ae..8685d4e7b45 100644 --- a/static/scripts/trackster.js +++ b/static/scripts/trackster.js @@ -181,6 +181,7 @@ var // Other constants. DENSITY = 200, + RESOLUTION = 5, FEATURE_LEVELS = 10, DEFAULT_DATA_QUERY_WAIT = 5000, // Maximum number of chromosomes that are selectable at any one time. @@ -762,7 +763,7 @@ extend( View.prototype, { this.high = Math.ceil(high); // 10^log10(range / DENSITY) Close approximation for browser window, assuming DENSITY = window width - this.resolution = Math.pow( 10, Math.ceil( Math.log( (this.high - this.low) / DENSITY ) / Math.LN10 ) ); + this.resolution = Math.pow( RESOLUTION, Math.ceil( Math.log( (this.high - this.low) / DENSITY ) / Math.log(RESOLUTION) ) ); this.zoom_res = Math.pow( FEATURE_LEVELS, Math.max(0,Math.ceil( Math.log( this.resolution, FEATURE_LEVELS ) / Math.log(FEATURE_LEVELS) ))); // Overview