aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorZachary Sloan2013-02-20 18:03:01 -0600
committerZachary Sloan2013-02-20 18:03:01 -0600
commite727d9689d3f0dfb7fc69a3377dd7f5375a8b903 (patch)
tree4c495074636befd84d8b6879f01ebab3e0a2dc5f /wqflask
parent475c96934a97bf56f4f7a6940249f2f25923e7c5 (diff)
downloadgenenetwork2-e727d9689d3f0dfb7fc69a3377dd7f5375a8b903.tar.gz
Did more work with manhattan plot, trying to fix a small issue
with the location of points on the x-axis
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/static/new/javascript/marker_regression.coffee20
-rw-r--r--wqflask/wqflask/static/new/javascript/marker_regression.js15
2 files changed, 23 insertions, 12 deletions
diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.coffee b/wqflask/wqflask/static/new/javascript/marker_regression.coffee
index 4c67c5a5..2b09fbc8 100644
--- a/wqflask/wqflask/static/new/javascript/marker_regression.coffee
+++ b/wqflask/wqflask/static/new/javascript/marker_regression.coffee
@@ -5,29 +5,31 @@ $ ->
@chromosomes = js_data.chromosomes
@total_length = 0
-
+
@max_chr = @get_max_chr()
- @scaled_chr_lengths = @get_chr_lengths()
@x_coords = []
@y_coords = []
@marker_names = []
@create_coordinates()
+ @scaled_chr_lengths = @get_chr_lengths()
# Buffer to allow for the ticks/labels to be drawn
- @x_buffer = @plot_width/30
+ @x_buffer = @plot_width/25
@y_buffer = @plot_height/20
- @x_max = d3.max(@x_coords)
+ #@x_max = d3.max(@x_coords)
+ console.log("x_max is", d3.max(@x_coords))
+ @x_max = @total_length
+ console.log("x_max is", @x_max)
@y_max = d3.max(@y_coords) * 1.2
@svg = @create_svg()
@plot_coordinates = _.zip(@x_coords, @y_coords, @marker_names)
- @plot_height = @plot_height - @y_buffer
+ @plot_height -= @y_buffer
@create_scales()
@create_graph()
-
get_max_chr: () ->
max_chr = 0
for result in @qtl_results
@@ -52,6 +54,8 @@ $ ->
this_length = @chromosomes[key]
cumulative_chr_lengths.push(total_length + this_length)
total_length += this_length
+
+ console.log("total length is:", total_length)
return cumulative_chr_lengths
@@ -69,6 +73,8 @@ $ ->
@x_coords.push(@total_length + parseFloat(result.Mb))
@y_coords.push(result.lod_score)
@marker_names.push(result.name)
+ @total_length += chr_lengths[chr_lengths.length-1]
+ console.log("total length is", @total_length)
console.log("chr_lengths are:", chr_lengths)
@@ -93,7 +99,7 @@ $ ->
create_scales: () ->
@x_scale = d3.scale.linear()
- .domain([0, @x_max])
+ .domain([0, d3.max(@x_coords)])
.range([@x_buffer, @plot_width])
@y_scale = d3.scale.linear()
diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.js b/wqflask/wqflask/static/new/javascript/marker_regression.js
index 8b99b28f..38d88208 100644
--- a/wqflask/wqflask/static/new/javascript/marker_regression.js
+++ b/wqflask/wqflask/static/new/javascript/marker_regression.js
@@ -13,18 +13,20 @@
this.chromosomes = js_data.chromosomes;
this.total_length = 0;
this.max_chr = this.get_max_chr();
- this.scaled_chr_lengths = this.get_chr_lengths();
this.x_coords = [];
this.y_coords = [];
this.marker_names = [];
this.create_coordinates();
- this.x_buffer = this.plot_width / 30;
+ this.scaled_chr_lengths = this.get_chr_lengths();
+ this.x_buffer = this.plot_width / 25;
this.y_buffer = this.plot_height / 20;
- this.x_max = d3.max(this.x_coords);
+ console.log("x_max is", d3.max(this.x_coords));
+ this.x_max = this.total_length;
+ console.log("x_max is", this.x_max);
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);
- this.plot_height = this.plot_height - this.y_buffer;
+ this.plot_height -= this.y_buffer;
this.create_scales();
this.create_graph();
}
@@ -61,6 +63,7 @@
cumulative_chr_lengths.push(total_length + this_length);
total_length += this_length;
}
+ console.log("total length is:", total_length);
return cumulative_chr_lengths;
};
@@ -84,6 +87,8 @@
this.y_coords.push(result.lod_score);
this.marker_names.push(result.name);
}
+ this.total_length += chr_lengths[chr_lengths.length - 1];
+ console.log("total length is", this.total_length);
return console.log("chr_lengths are:", chr_lengths);
};
@@ -107,7 +112,7 @@
};
Manhattan_Plot.prototype.create_scales = function() {
- this.x_scale = d3.scale.linear().domain([0, this.x_max]).range([this.x_buffer, this.plot_width]);
+ 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([0, this.y_max]).range([this.plot_height, this.y_buffer]);
};