aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Sloan2013-04-19 19:14:30 +0000
committerZachary Sloan2013-04-19 19:14:30 +0000
commit184c763c55e9399eefaa2fa2ad7e663e39acddaf (patch)
tree4ffd68d97c85c8cb2a33c48d72126849ba483458
parent5ffd0debd5ab7ee0e98def74374a8e996629f5c9 (diff)
downloadgenenetwork2-184c763c55e9399eefaa2fa2ad7e663e39acddaf.tar.gz
Fixed the issue with the x-axis coordinates for marker regression plot
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/lmm.py1
-rw-r--r--wqflask/wqflask/static/new/javascript/marker_regression.coffee19
-rw-r--r--wqflask/wqflask/static/new/javascript/marker_regression.js15
3 files changed, 16 insertions, 19 deletions
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
index a6134fdd..2e8f020d 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
@@ -93,6 +93,7 @@ def run_human(pheno_vector,
result_store = []
identifier = uuid.uuid4()
for part, result in enumerate(results):
+ # todo: Don't use TempData here. Instead revert old one and store this stuff as a list
data_store = temp_data.TempData(identifier, "plink", part)
data_store.store("data", pickle.dumps(result, pickle.HIGHEST_PROTOCOL))
diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.coffee b/wqflask/wqflask/static/new/javascript/marker_regression.coffee
index fd1fac54..2f8da6dc 100644
--- a/wqflask/wqflask/static/new/javascript/marker_regression.coffee
+++ b/wqflask/wqflask/static/new/javascript/marker_regression.coffee
@@ -4,18 +4,17 @@ $ ->
@qtl_results = js_data.qtl_results
console.log("qtl_results are:", @qtl_results)
@chromosomes = js_data.chromosomes
- console.log("chromosomes: ", @chromosomes)
@total_length = 0
@max_chr = @get_max_chr()
- console.log("max_chr is: ", @max_chr)
@x_coords = []
@y_coords = []
@marker_names = []
console.time('Create coordinates')
@create_coordinates()
+ console.log("@x_coords: ", @x_coords)
console.timeEnd('Create coordinates')
[@chr_lengths, @cumulative_chr_lengths] = @get_chr_lengths()
@@ -25,7 +24,6 @@ $ ->
#@x_max = d3.max(@x_coords)
@x_max = @total_length
- @y_min = d3.min(@y_coords)
@y_max = d3.max(@y_coords) * 1.2
@svg = @create_svg()
@@ -58,7 +56,7 @@ $ ->
chr_lengths = []
total_length = 0
for key of @chromosomes
- this_length = @chromosomes[key][1]
+ this_length = @chromosomes[key]
chr_lengths.push(this_length)
cumulative_chr_lengths.push(total_length + this_length)
total_length += this_length
@@ -71,11 +69,10 @@ $ ->
chr_lengths = []
chr_seen = []
for result in js_data.qtl_results
- chr_length = @chromosomes[result.chr][1]
+ chr_length = @chromosomes[result.chr]
if not(result.chr in chr_seen)
chr_seen.push(result.chr)
- chr_lengths.push(chr_length)
-
+ chr_lengths.push(chr_length)
if result.chr != "1"
@total_length += chr_lengths[chr_lengths.length - 2]
@x_coords.push(@total_length + parseFloat(result.Mb))
@@ -106,7 +103,7 @@ $ ->
@add_x_axis()
@add_y_axis()
@add_chr_lines()
- #@fill_chr_areas()
+ @fill_chr_areas()
@add_chr_labels()
@add_plot_points()
@@ -140,7 +137,7 @@ $ ->
.range([@x_buffer, @plot_width])
@y_scale = d3.scale.linear()
- .domain([@y_min, @y_max])
+ .domain([0, @y_max])
.range([@plot_height, @y_buffer])
create_x_axis_tick_values: () ->
@@ -246,7 +243,7 @@ $ ->
add_chr_labels: () ->
chr_names = []
for key of @chromosomes
- chr_names.push(@chromosomes[key][0])
+ chr_names.push(key)
chr_info = _.zip(chr_names, @chr_lengths, @cumulative_chr_lengths)
@svg.selectAll("text")
.data(chr_info, (d) =>
@@ -276,7 +273,7 @@ $ ->
return @x_buffer + ((@plot_width-@x_buffer) * d[0]/@x_max)
)
.attr("cy", (d) =>
- return @plot_height - ((@plot_height-@y_buffer) * (d[1]-@y_min)/@y_max)
+ return @plot_height - ((@plot_height-@y_buffer) * d[1]/@y_max)
)
.attr("r", 2)
.attr("id", (d) =>
diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.js b/wqflask/wqflask/static/new/javascript/marker_regression.js
index 37a4e1e5..50578125 100644
--- a/wqflask/wqflask/static/new/javascript/marker_regression.js
+++ b/wqflask/wqflask/static/new/javascript/marker_regression.js
@@ -13,21 +13,19 @@
this.qtl_results = js_data.qtl_results;
console.log("qtl_results are:", this.qtl_results);
this.chromosomes = js_data.chromosomes;
- console.log("chromosomes: ", this.chromosomes);
this.total_length = 0;
this.max_chr = this.get_max_chr();
- console.log("max_chr is: ", this.max_chr);
this.x_coords = [];
this.y_coords = [];
this.marker_names = [];
console.time('Create coordinates');
this.create_coordinates();
+ console.log("@x_coords: ", this.x_coords);
console.timeEnd('Create coordinates');
_ref = this.get_chr_lengths(), this.chr_lengths = _ref[0], this.cumulative_chr_lengths = _ref[1];
this.x_buffer = this.plot_width / 30;
this.y_buffer = this.plot_height / 20;
this.x_max = this.total_length;
- this.y_min = d3.min(this.y_coords);
this.y_max = d3.max(this.y_coords) * 1.2;
this.svg = this.create_svg();
this.plot_coordinates = _.zip(this.x_coords, this.y_coords, this.marker_names);
@@ -66,7 +64,7 @@
chr_lengths = [];
total_length = 0;
for (key in this.chromosomes) {
- this_length = this.chromosomes[key][1];
+ this_length = this.chromosomes[key];
chr_lengths.push(this_length);
cumulative_chr_lengths.push(total_length + this_length);
total_length += this_length;
@@ -81,7 +79,7 @@
_ref = js_data.qtl_results;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
result = _ref[_i];
- chr_length = this.chromosomes[result.chr][1];
+ chr_length = this.chromosomes[result.chr];
if (!(_ref1 = result.chr, __indexOf.call(chr_seen, _ref1) >= 0)) {
chr_seen.push(result.chr);
chr_lengths.push(chr_length);
@@ -121,6 +119,7 @@
this.add_x_axis();
this.add_y_axis();
this.add_chr_lines();
+ this.fill_chr_areas();
this.add_chr_labels();
return this.add_plot_points();
};
@@ -142,7 +141,7 @@
Manhattan_Plot.prototype.create_scales = function() {
this.x_scale = d3.scale.linear().domain([0, d3.max(this.x_coords)]).range([this.x_buffer, this.plot_width]);
- return this.y_scale = d3.scale.linear().domain([this.y_min, this.y_max]).range([this.plot_height, this.y_buffer]);
+ return this.y_scale = d3.scale.linear().domain([0, this.y_max]).range([this.plot_height, this.y_buffer]);
};
Manhattan_Plot.prototype.create_x_axis_tick_values = function() {
@@ -233,7 +232,7 @@
_this = this;
chr_names = [];
for (key in this.chromosomes) {
- chr_names.push(this.chromosomes[key][0]);
+ chr_names.push(key);
}
chr_info = _.zip(chr_names, this.chr_lengths, this.cumulative_chr_lengths);
return this.svg.selectAll("text").data(chr_info, function(d) {
@@ -250,7 +249,7 @@
return this.svg.selectAll("circle").data(this.plot_coordinates).enter().append("circle").attr("cx", function(d) {
return _this.x_buffer + ((_this.plot_width - _this.x_buffer) * d[0] / _this.x_max);
}).attr("cy", function(d) {
- return _this.plot_height - ((_this.plot_height - _this.y_buffer) * (d[1] - _this.y_min) / _this.y_max);
+ return _this.plot_height - ((_this.plot_height - _this.y_buffer) * d[1] / _this.y_max);
}).attr("r", 2).attr("id", function(d) {
return "point_" + String(d[2]);
}).classed("circle", true).on("mouseover", function(d) {