From 2085f376bc1a6fbb1a2d66f2220552e7c2baffdb Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Thu, 17 Oct 2013 16:51:45 -0500 Subject: Added file for the correlation scatterplot and added the @app to views.py Added the link to the corr plot page to the correlation page template --- wqflask/wqflask/correlation/corr_scatter_plot.py | 28 ++++++++++++++++++++++++ wqflask/wqflask/templates/correlation_page.html | 2 +- wqflask/wqflask/views.py | 6 ++++- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 wqflask/wqflask/correlation/corr_scatter_plot.py (limited to 'wqflask') 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 4d09cf20..7db8ea49 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -52,7 +52,7 @@