1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9d234e34bf3e/ Changeset: 9d234e34bf3e User: jgoecks Date: 2013-05-17 18:06:14 Summary: Trackster: enable composite feature tracks. When feature/read tracks are composited, coverage data for each track is composited together. Affected #: 1 file diff -r 7aee9615091381ba6b4f037fa46d226f2d89d5a4 -r 9d234e34bf3edcc7d31a0105cf4eef6393185d9a static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -5,13 +5,6 @@ var extend = _.extend; -/** - * Helper to determine if object is jQuery deferred. - */ -var is_deferred = function ( d ) { - return ( 'isResolved' in d ); -}; - // ---- Web UI specific utilities ---- /** @@ -179,7 +172,10 @@ DATA_LOADING = "Loading data...", DATA_OK = "Ready for display", TILE_CACHE_SIZE = 10, - DATA_CACHE_SIZE = 20; + DATA_CACHE_SIZE = 20, + + // Numerical/continuous data display modes. + CONTINUOUS_DATA_MODES = ["Histogram", "Line", "Filled", "Intensity"]; /** * Round a number to a given number of decimal places. @@ -829,13 +825,6 @@ * Replace group with a single composite track that includes all group's tracks. */ show_composite_track: function() { - // Create composite track name. - var drawables_names = []; - for (var i = 0; i < this.drawables.length; i++) { - drawables_names.push(this.drawables[i].name); - } - - // Replace this group with composite track. var composite_track = new CompositeTrack(this.view, this.view, { name: this.name, drawables: this.drawables @@ -3048,7 +3037,7 @@ return !(tile instanceof LineTrackTile); }); - if (tiles.length !== non_line_track_tiles.length) { + if (non_line_track_tiles.length > 0 && non_line_track_tiles.length < tiles.length) { // Clear because this is set when drawing. this.max_height_px = 0; var track = this; @@ -3113,10 +3102,13 @@ // Function that returns data/Deferreds needed to draw tile. var get_tile_data = function() { + // HACK: if display mode (mode) is in continuous data modes, data mode must be coverage to get coverage data. + var data_mode = (_.find(CONTINUOUS_DATA_MODES, function(m) { return m === mode; }) ? "Coverage" : mode); + // Map drawable object to data needed for drawing. var tile_data = _.map(drawables, function(d) { // Get the track data/promise. - return d.data_manager.get_data(region, mode, resolution, track.data_url_extra_params); + return d.data_manager.get_data(region, data_mode, resolution, track.data_url_extra_params); }); // Get reference data/promise. @@ -3399,9 +3391,11 @@ }); /** - * A tiled track composed of multiple other tracks. + * A tiled track composed of multiple other tracks. Composite tracks only work with + * bigwig data for now. */ var CompositeTrack = function(view, container, obj_dict) { + this.display_modes = CONTINUOUS_DATA_MODES; TiledTrack.call(this, view, container, obj_dict); // Init drawables; each drawable is a copy so that config/preferences @@ -3420,12 +3414,13 @@ } this.enabled = true; } - - // HACK: modes should be static class vars for most tracks and should update as - // needed for CompositeTracks - if (this.drawables.length !== 0) { - this.set_display_modes(this.drawables[0].display_modes, this.drawables[0].mode); - } + + // Set all feature tracks to use Coverage mode. + _.each(this.drawables, function(d) { + if (d instanceof FeatureTrack || d instanceof ReadTrack) { + d.change_mode("Coverage"); + } + }); this.update_icons(); @@ -3530,34 +3525,21 @@ TiledTrack.prototype.before_draw.call(this); // - // Set min, max for LineTracks to be largest min, max. + // Set min, max for tracks to be largest min, max. // // Get smallest min, biggest max. - var - min = Number.MAX_VALUE, - max = -min, - track; - for (var i = 0; i < this.drawables.length; i++) { - track = this.drawables[i]; - if (track instanceof LineTrack) { - if (track.prefs.min_value < min) { - min = track.prefs.min_value; - } - if (track.prefs.max_value > max) { - max = track.prefs.max_value; - } - } - } + var min = _.min(_.map(this.drawables, function(d) { return d.prefs.min_value; })), + max = _.max(_.map(this.drawables, function(d) { return d.prefs.max_value; })); + this.prefs.min_value = min; this.prefs.max_value = max; // Set all tracks to smallest min, biggest max. - for (var i = 0; i < this.drawables.length; i++) { - track = this.drawables[i]; - track.prefs.min_value = min; - track.prefs.max_value = max; - } + _.each(this.drawables, function(d) { + d.prefs.min_value = min; + d.prefs.max_value = max; + }); }, /** @@ -3681,7 +3663,7 @@ */ var LineTrack = function (view, container, obj_dict) { var track = this; - this.display_modes = ["Histogram", "Line", "Filled", "Intensity"]; + this.display_modes = CONTINUOUS_DATA_MODES; this.mode = "Histogram"; TiledTrack.call(this, view, container, obj_dict); @@ -4040,7 +4022,7 @@ // If data is line track data, draw line track tile. if (result.dataset_type === 'bigwig') { - return this._draw_line_track_tile(result, ctx, 'Histogram', resolution, region, w_scale); + return this._draw_line_track_tile(result, ctx, mode, resolution, region, w_scale); } // Handle row-by-row tracks @@ -4297,7 +4279,9 @@ { key: 'show_insertions', label: 'Show insertions', type: 'bool', default_value: false }, { key: 'show_differences', label: 'Show differences only', type: 'bool', default_value: true }, { key: 'show_counts', label: 'Show summary counts', type: 'bool', default_value: true }, - { key: 'mode', type: 'string', default_value: this.mode, hidden: true } + { key: 'mode', type: 'string', default_value: this.mode, hidden: true }, + { key: 'min_value', label: 'Histogram minimum', type: 'float', default_value: null, help: 'clear value to set automatically' }, + { key: 'max_value', label: 'Histogram maximum', type: 'float', default_value: null, help: 'clear value to set automatically' } ], saved_values: obj_dict.prefs, onchange: function() { Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.