commit/galaxy-central: 4 new changesets
4 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/2c0c1070891c/ Changeset: 2c0c1070891c User: jgoecks Date: 2013-05-14 19:15:02 Summary: Trackster: LinePainter improvements to use block_color when drawing coverage plots and refactor min/max finding to us underscore functions. Affected #: 1 file diff -r 8882e45504a37ab9f87f2872df2a6749673bd741 -r 2c0c1070891cdef382f32c0c3780a06d9169a10d static/scripts/viz/trackster/painters.js --- a/static/scripts/viz/trackster/painters.js +++ b/static/scripts/viz/trackster/painters.js @@ -135,20 +135,11 @@ var LinePainter = function(data, view_start, view_end, prefs, mode) { Painter.call( this, data, view_start, view_end, prefs, mode ); - var i, len; if ( this.prefs.min_value === undefined ) { - var min_value = Infinity; - for (i = 0, len = this.data.length; i < len; i++) { - min_value = Math.min( min_value, this.data[i][1] ); - } - this.prefs.min_value = min_value; + this.prefs.min_value = _.min( _.map(this.data, function(d) { return d[1]; }) ) || 0; } if ( this.prefs.max_value === undefined ) { - var max_value = -Infinity; - for (i = 0, len = this.data.length; i < len; i++) { - max_value = Math.max( max_value, this.data[i][1] ); - } - this.prefs.max_value = max_value; + this.prefs.max_value = _.max( _.map(this.data, function(d) { return d[1]; }) ) || 0; } }; @@ -184,15 +175,17 @@ delta_x_px = 10; } - // Extract RGB from preference color. - var pref_color = parseInt( this.prefs.color.slice(1), 16 ), + // Painter color can be in either block_color (FeatureTrack) or color pref (LineTrack). + var painter_color = this.prefs.block_color || this.prefs.color, + // Extract RGB from preference color. + pref_color = parseInt( painter_color.slice(1), 16 ), pref_r = (pref_color & 0xff0000) >> 16, pref_g = (pref_color & 0x00ff00) >> 8, pref_b = pref_color & 0x0000ff; // Paint track. for (var i = 0, len = data.length; i < len; i++) { - ctx.fillStyle = ctx.strokeStyle = this.prefs.color; + ctx.fillStyle = ctx.strokeStyle = painter_color; // -0.5 to offset drawing between bases. x_scaled = Math.round((data[i][0] - view_start - 0.5) * w_scale); y = data[i][1]; @@ -261,7 +254,7 @@ ctx.fillRect(x_scaled, height_px - 3, overflow_x, 3); } } - ctx.fillStyle = this.prefs.color; + ctx.fillStyle = painter_color; } if (mode === "Filled") { if (in_path) { https://bitbucket.org/galaxy/galaxy-central/commits/f4f596595970/ Changeset: f4f596595970 User: jgoecks Date: 2013-05-14 20:56:09 Summary: Add interval-to-bigwig converter, which creates a bigwig of coverage data for an interval dataset. Affected #: 2 files diff -r 2c0c1070891cdef382f32c0c3780a06d9169a10d -r f4f59659597023ad3b68b631da3b085dc98b15ed datatypes_conf.xml.sample --- a/datatypes_conf.xml.sample +++ b/datatypes_conf.xml.sample @@ -17,7 +17,6 @@ </datatype><datatype extension="bed" type="galaxy.datatypes.interval:Bed" display_in_upload="true"><converter file="bed_to_gff_converter.xml" target_datatype="gff"/> - <converter file="interval_to_coverage.xml" target_datatype="coverage"/><converter file="bed_to_bgzip_converter.xml" target_datatype="bgzip"/><converter file="bed_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/><converter file="bed_gff_or_vcf_to_bigwig_converter.xml" target_datatype="bigwig"/> diff -r 2c0c1070891cdef382f32c0c3780a06d9169a10d -r f4f59659597023ad3b68b631da3b085dc98b15ed lib/galaxy/datatypes/converters/interval_to_bigwig_converter.xml --- /dev/null +++ b/lib/galaxy/datatypes/converters/interval_to_bigwig_converter.xml @@ -0,0 +1,33 @@ +<tool id="CONVERTER_interval_to_bigwig_0" name="Convert Genomic Intervals To Coverage"> + <!-- <description>__NOT_USED_CURRENTLY_FOR_CONVERTERS__</description> --> + <!-- Used on the metadata edit page. --> + <command> + + ## Remove comments and sort by chromosome. + grep -v '^#' $input1 | sort -k${input1.metadata.chromCol},${input1.metadata.chromCol} | + + ## Create simple BED by cutting chrom, start, and end columns. + awk -v OFS=' ' '{print $${input1.metadata.chromCol},$${input1.metadata.startCol},$${input1.metadata.endCol} }' | + + ## Generate coverage bedgraph. + bedtools genomecov -bg -split -i stdin -g $chromInfo + + ## Streaming the bedgraph file to wigToBigWig is fast but very memory intensive; hence, this + ## should only be used on systems with large RAM. + ## | wigToBigWig stdin $chromInfo $output + + ## This can be used anywhere. + > temp.bg ; bedGraphToBigWig temp.bg $chromInfo $output + + </command> + <inputs> + <page> + <param format="interval" name="input1" type="data" label="Choose intervals"/> + </page> + </inputs> + <outputs> + <data format="bigwig" name="output"/> + </outputs> + <help> + </help> +</tool> https://bitbucket.org/galaxy/galaxy-central/commits/15224c9c15d9/ Changeset: 15224c9c15d9 User: jgoecks Date: 2013-05-14 21:46:27 Summary: Trackster: use deferred rather than flags to manage tile drawing. Affected #: 1 file diff -r f4f59659597023ad3b68b631da3b085dc98b15ed -r 15224c9c15d9de6323892207fff44520a23e3084 static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -3102,34 +3102,39 @@ } return tile; } - - // Flag to track whether we can draw everything now - var can_draw_now = true; - - // Get the track data, maybe a deferred - var tile_data = track.data_manager.get_data(region, mode, resolution, track.data_url_extra_params); - if ( is_deferred( tile_data ) ) { - can_draw_now = false; - } - - // Get reference data if needed, maybe a deferred - var seq_data; - if ( view.reference_track ) { - seq_data = view.reference_track.data_manager.get_data(region, mode, resolution, view.reference_track.data_url_extra_params); - if ( is_deferred( seq_data ) ) { - can_draw_now = false; + + // Function that returns data/Deferreds needed to draw tile. + var get_data = function() { + // Get the track data, maybe a deferred + var tile_data = track.data_manager.get_data(region, track.mode, resolution, track.data_url_extra_params); + + // Get reference data if needed, maybe a deferred + var seq_data; + if ( view.reference_track ) { + seq_data = view.reference_track.data_manager.get_data(region, track.mode, resolution, view.reference_track.data_url_extra_params); + } + + return [tile_data, seq_data]; + }; + + // + // When data is available, draw tile. + // + var tile_drawn = $.Deferred(); + track.tile_cache.set_elt(key, tile_drawn); + $.when.apply($, get_data()).then( function() { + var data = get_data(), + tile_data = data[0], + seq_data = data[1]; + + // Set up and draw tile. + extend(tile_data, kwargs[ 'more_tile_data' ] ); + + // If sequence data is available, subset to get only data in region. + if (view.reference_track) { + seq_data = view.reference_track.data_manager.subset_entry(seq_data, region); } - else { - // Sequence data is available, subset to get only data in region. - seq_data = view.reference_track.data_manager.subset_entry(seq_data, region); - } - } - - // If we can draw now, do so. - if ( can_draw_now ) { - // Set up and draw tile. - extend(tile_data, kwargs[ 'more_tile_data' ] ); - + // HACK: this is FeatureTrack-specific. // If track mode is Auto, determine mode and update. if (mode === "Auto" && track.get_mode) { @@ -3138,8 +3143,7 @@ } // Draw canvas. - var - canvas = track.view.canvas_manager.new_canvas(), + var canvas = track.view.canvas_manager.new_canvas(), tile_low = region.get('start'), tile_high = region.get('end'), width = Math.ceil( (tile_high - tile_low) * w_scale ) + track.left_offset, @@ -3147,26 +3151,18 @@ canvas.width = width; canvas.height = height; var ctx = canvas.getContext('2d'); - ctx.translate(this.left_offset, 0); + ctx.translate(track.left_offset, 0); var tile = track.draw_tile(tile_data, ctx, mode, resolution, region, w_scale, seq_data); - + // Don't cache, show if no tile. if (tile !== undefined) { track.tile_cache.set_elt(key, tile); track.show_tile(tile, parent_element, w_scale); } - return tile; - } - - // Can't draw now, so put Deferred in cache and draw tile when data is available. - var tile_drawn = $.Deferred(); - track.tile_cache.set_elt(key, tile_drawn); - $.when( tile_data, seq_data ).then( function() { - // Draw tile--force to clear Deferred from cache--and resolve. - tile = track.draw_helper(true, region, resolution, parent_element, w_scale, kwargs); + tile_drawn.resolve(tile); }); - + return tile_drawn; }, https://bitbucket.org/galaxy/galaxy-central/commits/4573880b2d9b/ Changeset: 4573880b2d9b User: jgoecks Date: 2013-05-14 21:47:42 Summary: Automated merge. Affected #: 4 files diff -r 1a4b56a78124b26103c61f8e6e736b088e65aa6d -r 4573880b2d9b7a76abcbe2ccac824ab9338df802 datatypes_conf.xml.sample --- a/datatypes_conf.xml.sample +++ b/datatypes_conf.xml.sample @@ -17,7 +17,6 @@ </datatype><datatype extension="bed" type="galaxy.datatypes.interval:Bed" display_in_upload="true"><converter file="bed_to_gff_converter.xml" target_datatype="gff"/> - <converter file="interval_to_coverage.xml" target_datatype="coverage"/><converter file="bed_to_bgzip_converter.xml" target_datatype="bgzip"/><converter file="bed_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/><converter file="bed_gff_or_vcf_to_bigwig_converter.xml" target_datatype="bigwig"/> diff -r 1a4b56a78124b26103c61f8e6e736b088e65aa6d -r 4573880b2d9b7a76abcbe2ccac824ab9338df802 lib/galaxy/datatypes/converters/interval_to_bigwig_converter.xml --- /dev/null +++ b/lib/galaxy/datatypes/converters/interval_to_bigwig_converter.xml @@ -0,0 +1,33 @@ +<tool id="CONVERTER_interval_to_bigwig_0" name="Convert Genomic Intervals To Coverage"> + <!-- <description>__NOT_USED_CURRENTLY_FOR_CONVERTERS__</description> --> + <!-- Used on the metadata edit page. --> + <command> + + ## Remove comments and sort by chromosome. + grep -v '^#' $input1 | sort -k${input1.metadata.chromCol},${input1.metadata.chromCol} | + + ## Create simple BED by cutting chrom, start, and end columns. + awk -v OFS=' ' '{print $${input1.metadata.chromCol},$${input1.metadata.startCol},$${input1.metadata.endCol} }' | + + ## Generate coverage bedgraph. + bedtools genomecov -bg -split -i stdin -g $chromInfo + + ## Streaming the bedgraph file to wigToBigWig is fast but very memory intensive; hence, this + ## should only be used on systems with large RAM. + ## | wigToBigWig stdin $chromInfo $output + + ## This can be used anywhere. + > temp.bg ; bedGraphToBigWig temp.bg $chromInfo $output + + </command> + <inputs> + <page> + <param format="interval" name="input1" type="data" label="Choose intervals"/> + </page> + </inputs> + <outputs> + <data format="bigwig" name="output"/> + </outputs> + <help> + </help> +</tool> diff -r 1a4b56a78124b26103c61f8e6e736b088e65aa6d -r 4573880b2d9b7a76abcbe2ccac824ab9338df802 static/scripts/viz/trackster/painters.js --- a/static/scripts/viz/trackster/painters.js +++ b/static/scripts/viz/trackster/painters.js @@ -135,20 +135,11 @@ var LinePainter = function(data, view_start, view_end, prefs, mode) { Painter.call( this, data, view_start, view_end, prefs, mode ); - var i, len; if ( this.prefs.min_value === undefined ) { - var min_value = Infinity; - for (i = 0, len = this.data.length; i < len; i++) { - min_value = Math.min( min_value, this.data[i][1] ); - } - this.prefs.min_value = min_value; + this.prefs.min_value = _.min( _.map(this.data, function(d) { return d[1]; }) ) || 0; } if ( this.prefs.max_value === undefined ) { - var max_value = -Infinity; - for (i = 0, len = this.data.length; i < len; i++) { - max_value = Math.max( max_value, this.data[i][1] ); - } - this.prefs.max_value = max_value; + this.prefs.max_value = _.max( _.map(this.data, function(d) { return d[1]; }) ) || 0; } }; @@ -184,15 +175,17 @@ delta_x_px = 10; } - // Extract RGB from preference color. - var pref_color = parseInt( this.prefs.color.slice(1), 16 ), + // Painter color can be in either block_color (FeatureTrack) or color pref (LineTrack). + var painter_color = this.prefs.block_color || this.prefs.color, + // Extract RGB from preference color. + pref_color = parseInt( painter_color.slice(1), 16 ), pref_r = (pref_color & 0xff0000) >> 16, pref_g = (pref_color & 0x00ff00) >> 8, pref_b = pref_color & 0x0000ff; // Paint track. for (var i = 0, len = data.length; i < len; i++) { - ctx.fillStyle = ctx.strokeStyle = this.prefs.color; + ctx.fillStyle = ctx.strokeStyle = painter_color; // -0.5 to offset drawing between bases. x_scaled = Math.round((data[i][0] - view_start - 0.5) * w_scale); y = data[i][1]; @@ -261,7 +254,7 @@ ctx.fillRect(x_scaled, height_px - 3, overflow_x, 3); } } - ctx.fillStyle = this.prefs.color; + ctx.fillStyle = painter_color; } if (mode === "Filled") { if (in_path) { diff -r 1a4b56a78124b26103c61f8e6e736b088e65aa6d -r 4573880b2d9b7a76abcbe2ccac824ab9338df802 static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -3102,34 +3102,39 @@ } return tile; } - - // Flag to track whether we can draw everything now - var can_draw_now = true; - - // Get the track data, maybe a deferred - var tile_data = track.data_manager.get_data(region, mode, resolution, track.data_url_extra_params); - if ( is_deferred( tile_data ) ) { - can_draw_now = false; - } - - // Get reference data if needed, maybe a deferred - var seq_data; - if ( view.reference_track ) { - seq_data = view.reference_track.data_manager.get_data(region, mode, resolution, view.reference_track.data_url_extra_params); - if ( is_deferred( seq_data ) ) { - can_draw_now = false; + + // Function that returns data/Deferreds needed to draw tile. + var get_data = function() { + // Get the track data, maybe a deferred + var tile_data = track.data_manager.get_data(region, track.mode, resolution, track.data_url_extra_params); + + // Get reference data if needed, maybe a deferred + var seq_data; + if ( view.reference_track ) { + seq_data = view.reference_track.data_manager.get_data(region, track.mode, resolution, view.reference_track.data_url_extra_params); + } + + return [tile_data, seq_data]; + }; + + // + // When data is available, draw tile. + // + var tile_drawn = $.Deferred(); + track.tile_cache.set_elt(key, tile_drawn); + $.when.apply($, get_data()).then( function() { + var data = get_data(), + tile_data = data[0], + seq_data = data[1]; + + // Set up and draw tile. + extend(tile_data, kwargs[ 'more_tile_data' ] ); + + // If sequence data is available, subset to get only data in region. + if (view.reference_track) { + seq_data = view.reference_track.data_manager.subset_entry(seq_data, region); } - else { - // Sequence data is available, subset to get only data in region. - seq_data = view.reference_track.data_manager.subset_entry(seq_data, region); - } - } - - // If we can draw now, do so. - if ( can_draw_now ) { - // Set up and draw tile. - extend(tile_data, kwargs[ 'more_tile_data' ] ); - + // HACK: this is FeatureTrack-specific. // If track mode is Auto, determine mode and update. if (mode === "Auto" && track.get_mode) { @@ -3138,8 +3143,7 @@ } // Draw canvas. - var - canvas = track.view.canvas_manager.new_canvas(), + var canvas = track.view.canvas_manager.new_canvas(), tile_low = region.get('start'), tile_high = region.get('end'), width = Math.ceil( (tile_high - tile_low) * w_scale ) + track.left_offset, @@ -3147,26 +3151,18 @@ canvas.width = width; canvas.height = height; var ctx = canvas.getContext('2d'); - ctx.translate(this.left_offset, 0); + ctx.translate(track.left_offset, 0); var tile = track.draw_tile(tile_data, ctx, mode, resolution, region, w_scale, seq_data); - + // Don't cache, show if no tile. if (tile !== undefined) { track.tile_cache.set_elt(key, tile); track.show_tile(tile, parent_element, w_scale); } - return tile; - } - - // Can't draw now, so put Deferred in cache and draw tile when data is available. - var tile_drawn = $.Deferred(); - track.tile_cache.set_elt(key, tile_drawn); - $.when( tile_data, seq_data ).then( function() { - // Draw tile--force to clear Deferred from cache--and resolve. - tile = track.draw_helper(true, region, resolution, parent_element, w_scale, kwargs); + tile_drawn.resolve(tile); }); - + return tile_drawn; }, 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.
participants (1)
-
commits-noreply@bitbucket.org