commit/galaxy-central: kanwei: trackster: Fix summary_tree and error messages
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/1bd01a7a6cf7/ changeset: r5170:1bd01a7a6cf7 user: kanwei date: 2011-03-03 22:32:04 summary: trackster: Fix summary_tree and error messages affected #: 2 files (268 bytes) --- a/lib/galaxy/visualization/tracks/data_providers.py Thu Mar 03 15:38:48 2011 -0500 +++ b/lib/galaxy/visualization/tracks/data_providers.py Thu Mar 03 16:32:04 2011 -0500 @@ -21,6 +21,7 @@ from pysam import csamtools MAX_VALS = 5000 # only display first MAX_VALS features +ERROR_MAX_VALS = "Only the first " + str(MAX_VALS) + " %s in this tile are displayed." # Return None instead of NaN to pass jQuery 1.4's strict JSON def float_nan(n): @@ -199,7 +200,7 @@ for start, end, offset in index.find(chrom, start, end): if count >= MAX_VALS: - message = "Only the first %s features are being displayed." % MAX_VALS + message = ERROR_MAX_VALS % "features" break count += 1 source.seek(offset) @@ -290,7 +291,7 @@ paired_pending = {} for read in data: if len(results) > MAX_VALS: - message = "Only the first %s reads are being displayed." % MAX_VALS + message = ERROR_MAX_VALS % "reads" break qname = read.qname seq = read.seq @@ -511,7 +512,7 @@ no_detail = ( "no_detail" in kwargs ) for start, end, offset in index.find(chrom, start, end): if count >= MAX_VALS: - message = "Only the first %s features are being displayed." % MAX_VALS + message = ERROR_MAX_VALS % "features" break count += 1 source.seek( offset ) @@ -580,7 +581,7 @@ if feature.chrom != chrom or feature_start < start or feature_end > end: continue if count >= MAX_VALS: - message = "Only the first %s features are being displayed." % MAX_VALS + message = ERROR_MAX_VALS % "features" break count += 1 payload = package_gff_feature( feature ) --- a/static/scripts/trackster.js Thu Mar 03 15:38:48 2011 -0500 +++ b/static/scripts/trackster.js Thu Mar 03 16:32:04 2011 -0500 @@ -135,6 +135,7 @@ DENSE_FEATURE_HEIGHT = 1, SQUISH_FEATURE_HEIGHT = 3, PACK_FEATURE_HEIGHT = 9, + ERROR_PADDING = 10, // Padding at the top of tracks for error messages LABEL_SPACING = 2, PACK_SPACING = 5, // Minimum width for window for squish to be used. @@ -2348,7 +2349,7 @@ feature_name = feature[3], f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ), f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ), - y_center = (mode === "Dense" ? 1 : (1 + slot)) * y_scale, + y_center = ERROR_PADDING + (mode === "Dense" ? 0 : (0 + slot)) * y_scale, thickness, y_start, thick_start = null, thick_end = null, block_color = this.prefs.block_color, label_color = this.prefs.label_color; @@ -2381,8 +2382,7 @@ if (mode === "Squish") { thin_height = 1; thick_height = SQUISH_FEATURE_HEIGHT; - } - else { // mode === "Pack" + } else { // mode === "Pack" thin_height = 5; thick_height = PACK_FEATURE_HEIGHT; } @@ -2401,8 +2401,7 @@ ctx.fillStyle = block_color; } ctx.fillRect(f_start + left_offset, y_center, f_end - f_start, thick_height); - } - else { + } else { // There are feature blocks and mode is either Squish or Pack. // // Approach: (a) draw whole feature as connector/intron and (b) draw blocks as @@ -2602,7 +2601,7 @@ if (mode === "summary_tree") { this.draw_summary_tree(canvas, result.data, result.delta, result.max, w_scale, required_height, tile_low, left_offset); - return canvas; + return callback(canvas); } // @@ -2610,16 +2609,19 @@ // FIXME: Why is this drawn on a canvas instead of a div? if (result.message) { canvas.css({ - "border-color": "red" + "border-top": "1px solid red" }); ctx.fillStyle = "red"; ctx.textAlign = "left"; - ctx.fillText(result.message, 100 + left_offset, y_scale); + var old_base = ctx.textBaseline; + ctx.textBaseline = "top"; + ctx.fillText(result.message, left_offset, 0); + ctx.textBaseline = old_base; // If there's no data, return. if (!result.data) { - return canvas; + return callback(canvas); } } @@ -2690,7 +2692,7 @@ // All features need a start, end, and vertical center. f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ), f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ), - y_center = (mode === "Dense" ? 1 : (1 + slot)) * y_scale, + y_center = ERROR_PADDING + (mode === "Dense" ? 0 : (0 + slot)) * y_scale, thickness, y_start, thick_start = null, thick_end = null; if (no_label) { 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)
-
Bitbucket