diff options
author | Zachary Sloan | 2013-01-09 17:42:47 -0600 |
---|---|---|
committer | Zachary Sloan | 2013-01-09 17:42:47 -0600 |
commit | 0e5e7335fca87bddb062d1470ab547044d5bcf42 (patch) | |
tree | 6f58f2e3ea4596b74477a827f74202648231b36b | |
parent | 092a6835f992afb3bfb15918b09d22220789ad14 (diff) | |
download | genenetwork2-0e5e7335fca87bddb062d1470ab547044d5bcf42.tar.gz |
Checking in before putting the histogram coffeescript into its own
class
3 files changed, 123 insertions, 114 deletions
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 52870d84..9bf97f93 100755 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -471,7 +471,7 @@ class MarkerRegression(object): suggestive_results = [] self.pure_qtl_results = [] for result in self.qtl_results: - self.pure_qtl_results.append(dict(locus=dict(cM=result.locus.cM, + self.pure_qtl_results.append(dict(locus=dict(mb=result.locus.Mb, chromosome=result.locus.chr), lrs=result.lrs, additive=result.additive)) diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.coffee b/wqflask/wqflask/static/new/javascript/marker_regression.coffee index f3485a82..7ffa0267 100644 --- a/wqflask/wqflask/static/new/javascript/marker_regression.coffee +++ b/wqflask/wqflask/static/new/javascript/marker_regression.coffee @@ -2,68 +2,76 @@ $ -> sort_number = (a, b) -> return a - b - process_lrs_array = -> - # Put the data in a format needed for graphing - # The permutation count for a particular integer range (10-11 or 12-13 for example) - # will be on the y-axis; LRS values will be on the x-axis - lrs_array = js_data.lrs_array - bars = {} - for lrs in lrs_array - floored = Math.floor(lrs) - if floored not of bars - bars[floored] = 0 - bars[floored] += 1 - # Now we need to take the unordered hash - # And order the keys - keys = [] - for key of bars - keys.push(key) - keys.sort(sort_number) + process_lrs_array = -> + # Put the data in a format needed for graphing + # The permutation count for a particular integer range (10-11 or 12-13 for example) + # will be on the y-axis; LRS values will be on the x-axis + lrs_array = js_data.lrs_array + bars = {} + for lrs in lrs_array + floored = Math.floor(lrs) + if floored not of bars + bars[floored] = 0 + bars[floored] += 1 + + # Now we need to take the unordered hash + # And order the keys + keys = [] + for key of bars + keys.push(key) - - # Now that we have the ordered keys above - # We can build an array of arrays that jqPlot will use - bars_ordered = [] - for key in keys - bars_ordered.push([parseInt(key), bars[key]]) - - console.log("bars is:", bars) - console.log("keys are:", keys) - console.log("bars_ordered are:", bars_ordered) - return bars_ordered - - display_permutation_histogram = (bars_ordered) -> - # Figure out the largest key, so we can make sure the x axis max is one larger later on - max_lrs = bars_ordered[bars_ordered.length-1][0] - console.log("max_key is:", max_lrs) + keys.sort(sort_number) + + + # Now that we have the ordered keys above + # We can build an array of arrays that jqPlot will use + bars_ordered = [] + for key in keys + bars_ordered.push([parseInt(key), bars[key]]) - $.jqplot('permutation_histogram', [bars_ordered], - title: 'Permutation Histogram' - seriesDefaults: - renderer:$.jqplot.BarRenderer - rendererOptions: - #barPadding: 30 - #barMargin: 30 - barWidth: 15 - #shadowOffset: 2 - #shadowDepth: 5 - #shadowAlpha: 0.8 - pointLabels: - show: true - axesDefaults: - labelRenderer: $.jqplot.CanvasAxisLabelRenderer - axes: - xaxis: - min: 0 - #max: max_lrs + 2 - label: "LRS" - pad: 1.1 - yaxis: - min: 0 - label: "Frequency" - ) + console.log("bars is:", bars) + console.log("keys are:", keys) + console.log("bars_ordered are:", bars_ordered) + return bars_ordered + + display_permutation_histogram = (bars_ordered) -> + # Figure out the largest key, so we can make sure the x axis max is one larger later on + max_lrs = bars_ordered[bars_ordered.length-1][0] + console.log("max_key is:", max_lrs) + + $.jqplot('permutation_histogram', [bars_ordered], + title: 'Permutation Histogram' + seriesDefaults: + renderer:$.jqplot.BarRenderer + rendererOptions: + #barPadding: 30 + #barMargin: 30 + barWidth: 15 + #shadowOffset: 2 + #shadowDepth: 5 + #shadowAlpha: 0.8 + pointLabels: + show: true + axesDefaults: + labelRenderer: $.jqplot.CanvasAxisLabelRenderer + axes: + xaxis: + min: 0 + #max: max_lrs + 2 + label: "LRS" + pad: 1.1 + yaxis: + min: 0 + label: "Frequency" + ) + + #process_qtl_results = -> + # qtl_results = js_data.qtl_results + + #display_manhattan_plot = -> + bars_ordered = process_lrs_array() diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.js b/wqflask/wqflask/static/new/javascript/marker_regression.js index ac85dc3d..5d429ddc 100644 --- a/wqflask/wqflask/static/new/javascript/marker_regression.js +++ b/wqflask/wqflask/static/new/javascript/marker_regression.js @@ -2,67 +2,68 @@ (function() { $(function() { - var bars_ordered, display_permutation_histogram, process_lrs_array, sort_number; + var bars_ordered, sort_number; sort_number = function(a, b) { + var display_permutation_histogram, process_lrs_array; return a - b; - }; - process_lrs_array = function() { - var bars, bars_ordered, floored, key, keys, lrs, lrs_array, _i, _j, _len, _len1; - lrs_array = js_data.lrs_array; - bars = {}; - for (_i = 0, _len = lrs_array.length; _i < _len; _i++) { - lrs = lrs_array[_i]; - floored = Math.floor(lrs); - if (!(floored in bars)) { - bars[floored] = 0; + process_lrs_array = function() { + var bars, bars_ordered, floored, key, keys, lrs, lrs_array, _i, _j, _len, _len1; + lrs_array = js_data.lrs_array; + bars = {}; + for (_i = 0, _len = lrs_array.length; _i < _len; _i++) { + lrs = lrs_array[_i]; + floored = Math.floor(lrs); + if (!(floored in bars)) { + bars[floored] = 0; + } + bars[floored] += 1; } - bars[floored] += 1; - } - keys = []; - for (key in bars) { - keys.push(key); - } - keys.sort(sort_number); - bars_ordered = []; - for (_j = 0, _len1 = keys.length; _j < _len1; _j++) { - key = keys[_j]; - bars_ordered.push([parseInt(key), bars[key]]); - } - console.log("bars is:", bars); - console.log("keys are:", keys); - console.log("bars_ordered are:", bars_ordered); - return bars_ordered; - }; - display_permutation_histogram = function(bars_ordered) { - var max_lrs; - max_lrs = bars_ordered[bars_ordered.length - 1][0]; - console.log("max_key is:", max_lrs); - return $.jqplot('permutation_histogram', [bars_ordered], { - title: 'Permutation Histogram', - seriesDefaults: { - renderer: $.jqplot.BarRenderer, - rendererOptions: { - barWidth: 15 + keys = []; + for (key in bars) { + keys.push(key); + } + keys.sort(sort_number); + bars_ordered = []; + for (_j = 0, _len1 = keys.length; _j < _len1; _j++) { + key = keys[_j]; + bars_ordered.push([parseInt(key), bars[key]]); + } + console.log("bars is:", bars); + console.log("keys are:", keys); + console.log("bars_ordered are:", bars_ordered); + return bars_ordered; + }; + return display_permutation_histogram = function(bars_ordered) { + var max_lrs; + max_lrs = bars_ordered[bars_ordered.length - 1][0]; + console.log("max_key is:", max_lrs); + return $.jqplot('permutation_histogram', [bars_ordered], { + title: 'Permutation Histogram', + seriesDefaults: { + renderer: $.jqplot.BarRenderer, + rendererOptions: { + barWidth: 15 + }, + pointLabels: { + show: true + } }, - pointLabels: { - show: true - } - }, - axesDefaults: { - labelRenderer: $.jqplot.CanvasAxisLabelRenderer - }, - axes: { - xaxis: { - min: 0, - label: "LRS", - pad: 1.1 + axesDefaults: { + labelRenderer: $.jqplot.CanvasAxisLabelRenderer }, - yaxis: { - min: 0, - label: "Frequency" + axes: { + xaxis: { + min: 0, + label: "LRS", + pad: 1.1 + }, + yaxis: { + min: 0, + label: "Frequency" + } } - } - }); + }); + }; }; bars_ordered = process_lrs_array(); return display_permutation_histogram(bars_ordered); |