diff options
author | Zachary Sloan | 2013-01-10 16:40:48 -0600 |
---|---|---|
committer | Zachary Sloan | 2013-01-10 16:40:48 -0600 |
commit | 632d1534712b7381f4330c4c2cac3e9d2e7f0c60 (patch) | |
tree | 8c5c04f59f1a4623de7b2cf7147a280df7302a67 /wqflask | |
parent | 258afa157e15c4f041a899e700fc25e941049e61 (diff) | |
download | genenetwork2-632d1534712b7381f4330c4c2cac3e9d2e7f0c60.tar.gz |
Normalized the y axis for each manhattan plot section
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/marker_regression.coffee | 19 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/marker_regression.js | 11 |
2 files changed, 21 insertions, 9 deletions
diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.coffee b/wqflask/wqflask/static/new/javascript/marker_regression.coffee index 3483f7eb..6a5e4d77 100644 --- a/wqflask/wqflask/static/new/javascript/marker_regression.coffee +++ b/wqflask/wqflask/static/new/javascript/marker_regression.coffee @@ -82,10 +82,12 @@ $ -> @max_mb = mb @plot_points.push([mb, lrs]) - display_graph: -> + display_graph: (max_lrs) -> div_name = 'manhattan_plot_' + @name console.log("div_name:", div_name) + #console.log("max_lrs is", max_lrs) + x_axis_max = Math.ceil(@max_mb/25) * 25 x_axis_ticks = [] x_tick = 0 @@ -115,20 +117,24 @@ $ -> label: "Megabases" yaxis: min: 0 + max: Math.floor(max_lrs + 0.1 * max_lrs) + tickInterval: 1 label: "LRS" tickOptions: + formatString: '%d' showGridline: false ) class Manhattan_Plot constructor: -> - @chromosomes = {} # Hash of chromosomes + @max_lrs = 0 + @chromosomes = {} @build_chromosomes() - #@process_data() @display_graphs() + build_chromosomes: -> for result in js_data.qtl_results #if result.locus.chromosome == '1' @@ -136,11 +142,10 @@ $ -> if chromosome not of @chromosomes @chromosomes[chromosome] = new Chromosome(chromosome) mb = parseInt(result.locus.mb) + if result.lrs > @max_lrs + @max_lrs = result.lrs @chromosomes[chromosome].process_point(mb, result.lrs) - #if mb > @max_mb - # @max_mb = mb - #@plot_points.push([mb, result.lrs]) display_graphs: -> ### Call display_graph for each chromosome ### @@ -163,7 +168,7 @@ $ -> html = """<div id="manhattan_plot_#{ key }" class="manhattan_plot_segment"></div>""" console.log("html is:", html) $("#manhattan_plots").append(html) - @chromosomes[key].display_graph() + @chromosomes[key].display_graph(@max_lrs) diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.js b/wqflask/wqflask/static/new/javascript/marker_regression.js index 0844cc12..fce31f79 100644 --- a/wqflask/wqflask/static/new/javascript/marker_regression.js +++ b/wqflask/wqflask/static/new/javascript/marker_regression.js @@ -87,7 +87,7 @@ return this.plot_points.push([mb, lrs]); }; - Chromosome.prototype.display_graph = function() { + Chromosome.prototype.display_graph = function(max_lrs) { var div_name, x_axis_max, x_axis_ticks, x_tick; div_name = 'manhattan_plot_' + this.name; console.log("div_name:", div_name); @@ -126,8 +126,11 @@ }, yaxis: { min: 0, + max: Math.floor(max_lrs + 0.1 * max_lrs), + tickInterval: 1, label: "LRS", tickOptions: { + formatString: '%d', showGridline: false } } @@ -141,6 +144,7 @@ Manhattan_Plot = (function() { function Manhattan_Plot() { + this.max_lrs = 0; this.chromosomes = {}; this.build_chromosomes(); this.display_graphs(); @@ -157,6 +161,9 @@ this.chromosomes[chromosome] = new Chromosome(chromosome); } mb = parseInt(result.locus.mb); + if (result.lrs > this.max_lrs) { + this.max_lrs = result.lrs; + } _results.push(this.chromosomes[chromosome].process_point(mb, result.lrs)); } return _results; @@ -186,7 +193,7 @@ html = "<div id=\"manhattan_plot_" + key + "\" class=\"manhattan_plot_segment\"></div>"; console.log("html is:", html); $("#manhattan_plots").append(html); - _results.push(this.chromosomes[key].display_graph()); + _results.push(this.chromosomes[key].display_graph(this.max_lrs)); } return _results; }; |