1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/b4e09ad82459/ changeset: b4e09ad82459 user: jgoecks date: 2012-09-25 16:52:28 summary: Fixes for ReferenceTracks to make compatible with recent refactoring. affected #: 3 files diff -r cdd39c933d24e11b4f99b5d24e5d1b108fea41ea -r b4e09ad8245967bc757c57f09a467bafd91ea370 static/scripts/viz/trackster/painters.js --- a/static/scripts/viz/trackster/painters.js +++ b/static/scripts/viz/trackster/painters.js @@ -729,7 +729,7 @@ /** * Draw a single read. */ - draw_read: function(ctx, mode, w_scale, y_center, tile_low, tile_high, feature_start, cigar, strand, orig_seq) { + draw_read: function(ctx, mode, w_scale, y_center, tile_low, tile_high, feature_start, cigar, strand, ref_seq) { ctx.textAlign = "center"; var tile_region = [tile_low, tile_high], base_offset = 0, @@ -743,12 +743,12 @@ // Gap is needed so that read is offset and hence first base can be drawn on read. // TODO-FIX: using this gap offsets reads so that their start is not visually in sync with other tracks. - if ((mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > char_width_px) { + if ((mode === "Pack" || this.mode === "Auto") && ref_seq !== undefined && w_scale > char_width_px) { gap = Math.round(w_scale/2); } if (!cigar) { // If no cigar string, then assume all matches - cigar = [ [0, orig_seq.length] ]; + cigar = [ [0, ref_seq.length] ]; } for (var cig_id = 0, len = cigar.length; cig_id < len; cig_id++) { var cig = cigar[cig_id], @@ -782,7 +782,8 @@ case "=": // Equals. if (is_overlap([seq_start, seq_start + cig_len], tile_region)) { // Draw. - var seq = orig_seq.slice(seq_offset, seq_offset + cig_len); + // -1 b/c sequence data is 1-based but painter is 0-based. + var seq = ref_seq.slice(seq_offset - 1, seq_offset + cig_len); if (gap > 0) { ctx.fillStyle = block_color; ctx.fillRect(s_start - gap, y_center + 1, s_end - s_start, 9); @@ -838,7 +839,8 @@ var insert_x_coord = s_start - gap; if (is_overlap([seq_start, seq_start + cig_len], tile_region)) { - var seq = orig_seq.slice(seq_offset, seq_offset + cig_len); + // -1 b/c sequence data is 1-based but painter is 0-based. + var seq = ref_seq.slice(seq_offset - 1, seq_offset + cig_len); // Insertion point is between the sequence start and the previous base: (-gap) moves // back from sequence start to insertion point. if (this.prefs.show_insertions) { @@ -849,7 +851,7 @@ // Draw sequence. // X center is offset + start - <half_sequence_length> var x_center = s_start - (s_end - s_start)/2; - if ( (mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > char_width_px) { + if ( (mode === "Pack" || this.mode === "Auto") && ref_seq !== undefined && w_scale > char_width_px) { // Draw sequence container. ctx.fillStyle = "yellow"; ctx.fillRect(x_center - gap, y_center - 9, s_end - s_start, 9); @@ -885,7 +887,7 @@ } } else { - if ( (mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > char_width_px) { + if ( (mode === "Pack" || this.mode === "Auto") && ref_seq !== undefined && w_scale > char_width_px) { // Show insertions with a single number at the insertion point. draw_last.push( { type: "text", data: [seq.length, insert_x_coord, y_center + 9] } ); } diff -r cdd39c933d24e11b4f99b5d24e5d1b108fea41ea -r b4e09ad8245967bc757c57f09a467bafd91ea370 static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -3427,7 +3427,7 @@ this.content_div.css("border", "none"); this.data_url = reference_url + "/" + this.view.dbkey; this.data_url_extra_params = {reference: true}; - this.data_manager = new ReferenceTrackDataManager({ + this.data_manager = new visualization.ReferenceTrackDataManager({ data_url: this.data_url }); this.hide_contents(); diff -r cdd39c933d24e11b4f99b5d24e5d1b108fea41ea -r b4e09ad8245967bc757c57f09a467bafd91ea370 static/scripts/viz/visualization.js --- a/static/scripts/viz/visualization.js +++ b/static/scripts/viz/visualization.js @@ -356,6 +356,13 @@ }); var ReferenceTrackDataManager = GenomeDataManager.extend({ + initialize: function(options) { + // Use generic object in place of dataset and set urlRoot to fetch data. + var dataset_placeholder = new Backbone.Model(); + dataset_placeholder.urlRoot = options.data_url; + this.set('dataset', dataset_placeholder); + }, + load_data: function(low, high, mode, resolution, extra_params) { if (resolution > 1) { // Now that data is pre-fetched before draw, we don't load reference tracks 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.