aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/correlation/corr_scatter_plot.py28
-rw-r--r--wqflask/wqflask/templates/correlation_page.html2
-rw-r--r--wqflask/wqflask/views.py5
3 files changed, 34 insertions, 1 deletions
diff --git a/wqflask/wqflask/correlation/corr_scatter_plot.py b/wqflask/wqflask/correlation/corr_scatter_plot.py
new file mode 100644
index 00000000..c3ae110d
--- /dev/null
+++ b/wqflask/wqflask/correlation/corr_scatter_plot.py
@@ -0,0 +1,28 @@
+from __future__ import absolute_import, print_function, division
+
+from base.trait import GeneralTrait
+from base import data_set
+from utility import corr_result_helpers
+
+class CorrScatterPlot(object):
+
+ def __init__(self, params):
+ print("params are:", params)
+ self.data_set_1 = data_set.create_dataset(params['dataset_1'])
+ self.data_set_2 = data_set.create_dataset(params['dataset_2'])
+ self.trait_1 = GeneralTrait(name=params['trait_1'], dataset=self.data_set_1)
+ self.trait_2 = GeneralTrait(name=params['trait_2'], dataset=self.data_set_2)
+
+ vals_1 = []
+ for sample in self.trait_1.data.keys():
+ vals_1.append(self.trait_1.data[sample].value)
+ vals_2 = []
+ for sample in self.trait_2.data.keys():
+ vals_2.append(self.trait_2.data[sample].value)
+
+ vals_1, vals_2, num_overlap = corr_result_helpers.normalize_values(vals_1, vals_2)
+
+ self.js_data = dict(
+ vals_1 = vals_1,
+ vals_2 = vals_2
+ ) \ No newline at end of file
diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html
index 7e149506..f3bb5531 100644
--- a/wqflask/wqflask/templates/correlation_page.html
+++ b/wqflask/wqflask/templates/correlation_page.html
@@ -48,7 +48,7 @@
<td>{{'%0.3f'|format(trait.mean)}}</td>
<td>{{'%0.3f'|format(trait.lrs)}}</td>
<td>Chr{{ trait.locus_chr }}:{{'%0.6f'|format(trait.locus_mb)}}</td>
- <td>{{'%0.3f'|format(trait.sample_r)}}</td>
+ <td><a href="corr_scatter_plot?dataset_1={{dataset.name}}&dataset_2={{trait.dataset.name}}&trait_1={{this_trait.name}}&trait_2={{trait.name}}&">{{'%0.3f'|format(trait.sample_r)}}</a></td>
<td>{{ trait.num_overlap }}</td>
<td>{{'%0.3e'|format(trait.sample_p)}}</td>
<td>{{'%0.3f'|format(trait.lit_corr)}}</td>
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 29f7f150..e6b99649 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -298,6 +298,11 @@ def corr_compute_page():
template_vars = show_corr_results.CorrelationResults(request.form)
return render_template("correlation_page.html", **template_vars.__dict__)
+@app.route("/corr_scatter_plot")
+def corr_scatter_plot_page():
+ template_vars = corr_scatter_plot.CorrScatterPlot(request.args)
+ return render_template("corr_scatter_plot.html", **template_vars.__dict__)
+
@app.route("/int_mapping", methods=('POST',))
def interval_mapping_page():
template_vars = interval_mapping.IntervalMapping(request.args)