aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/correlation/show_corr_results.py43
-rw-r--r--wqflask/wqflask/do_search.py1
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.js176
-rw-r--r--wqflask/wqflask/templates/base.html3
-rw-r--r--wqflask/wqflask/templates/marker_regression_gn1.html9
5 files changed, 158 insertions, 74 deletions
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index 2c6c3a14..73072423 100644
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -196,28 +196,29 @@ class CorrelationResults(object):
self.get_sample_r_and_p_values(trait, self.target_dataset.trait_data[trait])
elif self.corr_type == "sample":
- if self.dataset.type == "ProbeSet" and cache_available:
- dataset_file = open(webqtlConfig.GENERATED_TEXT_DIR+db_filename,'r')
-
- #XZ, 01/08/2009: read the first line
- line = dataset_file.readline()
- dataset_strains = webqtlUtil.readLineCSV(line)[1:]
-
- self.this_trait_vals = []
- for item in dataset_strains:
- if item in self.sample_data:
- self.this_trait_vals.append(self.sample_data[item])
- else:
- self.this_trait_vals.append("None")
- num_overlap = len(self.this_trait_vals)
- logger.debug("DOING PARALLEL")
- self.do_parallel_correlation(db_filename, num_overlap)
- else:
- for trait, values in self.target_dataset.trait_data.iteritems():
- self.get_sample_r_and_p_values(trait, values)
+ #ZS: Commented out since parallel correlation has issues with gunicorn
+ # if self.dataset.type == "ProbeSet" and cache_available:
+ # dataset_file = open(webqtlConfig.GENERATED_TEXT_DIR+db_filename,'r')
+
+ ##XZ, 01/08/2009: read the first line
+ # line = dataset_file.readline()
+ # dataset_strains = webqtlUtil.readLineCSV(line)[1:]
+
+ # self.this_trait_vals = []
+ # for item in dataset_strains:
+ # if item in self.sample_data:
+ # self.this_trait_vals.append(self.sample_data[item])
+ # else:
+ # self.this_trait_vals.append("None")
+ # num_overlap = len(self.this_trait_vals)
+ # logger.debug("DOING PARALLEL")
+ # self.do_parallel_correlation(db_filename, num_overlap)
+ # else:
+ for trait, values in self.target_dataset.trait_data.iteritems():
+ self.get_sample_r_and_p_values(trait, values)
- self.correlation_data = collections.OrderedDict(sorted(self.correlation_data.items(),
- key=lambda t: -abs(t[1][0])))
+ self.correlation_data = collections.OrderedDict(sorted(self.correlation_data.items(),
+ key=lambda t: -abs(t[1][0])))
if self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Geno":
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py
index e1df1e63..17625474 100644
--- a/wqflask/wqflask/do_search.py
+++ b/wqflask/wqflask/do_search.py
@@ -989,3 +989,4 @@ if __name__ == "__main__":
#results = GoSearch("0045202", dataset, cursor, db_conn).run()
logger.debug("results are:", pf(results))
+ db_conn.close()
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index df10c060..117d8f12 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -250,15 +250,29 @@
};
redraw_box_plot = function() {
- var x;
- var _i, _len, _ref, data;
- _ref = _.values(root.selected_samples[root.stats_group]);
- trait_vals = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- x = _ref[_i];
- trait_vals.push(x.value);
+ var y_value_list = []
+ for (var sample_group in root.selected_samples){
+ var trait_sample_data = _.values(root.selected_samples[sample_group])
+ var trait_vals = [];
+ for (i = 0, len = trait_sample_data.length; i < len; i++) {
+ this_sample_data = trait_sample_data[i];
+ trait_vals.push(this_sample_data.value);
+ }
+ y_value_list.push(trait_vals)
+ }
+
+ if (Object.keys(js_data.sample_group_types).length > 1) {
+ var update = {
+ y: y_value_list
+ }
+ console.log("REDRAW UPDATE:", update)
+ Plotly.restyle('box_plot', update, [0, 1, 2])
+ } else {
+ var update = {
+ y: y_value_list
+ }
+ Plotly.restyle('box_plot', update)
}
- Plotly.restyle('box_plot', 'y', [trait_vals])
}
redraw_prob_plot = function() {
@@ -640,6 +654,108 @@
};
root.stats_group = 'samples_primary';
+
+ if (Object.keys(js_data.sample_group_types).length > 1) {
+ full_sample_lists = [sample_lists[0], sample_lists[1], sample_lists[0].concat(sample_lists[1])]
+ sample_group_list = [js_data.sample_group_types['samples_primary'], js_data.sample_group_types['samples_other'], js_data.sample_group_types['samples_all']]
+ } else {
+ full_sample_lists = [sample_lists[0]]
+ sample_group_list = [js_data.sample_group_types['samples_primary']]
+ }
+
+ if (full_sample_lists.length > 1) {
+ var box_layout = {
+ width: 1200,
+ height: 500,
+ margin: {
+ l: 50,
+ r: 30,
+ t: 30,
+ b: 80
+ }
+ };
+ var trace1 = {
+ y: get_sample_vals(full_sample_lists[0]),
+ type: 'box',
+ name: sample_group_list[0],
+ boxpoints: 'all',
+ jitter: 0.5,
+ whiskerwidth: 0.2,
+ fillcolor: 'cls',
+ marker: {
+ size: 2
+ },
+ line: {
+ width: 1
+ }
+ }
+ var trace2 = {
+ y: get_sample_vals(full_sample_lists[1]),
+ type: 'box',
+ name: sample_group_list[1],
+ boxpoints: 'all',
+ jitter: 0.5,
+ whiskerwidth: 0.2,
+ fillcolor: 'cls',
+ marker: {
+ size: 2
+ },
+ line: {
+ width: 1
+ }
+ }
+ var trace3 = {
+ y: get_sample_vals(full_sample_lists[2]),
+ type: 'box',
+ name: sample_group_list[2],
+ boxpoints: 'all',
+ jitter: 0.5,
+ whiskerwidth: 0.2,
+ fillcolor: 'cls',
+ marker: {
+ size: 2
+ },
+ line: {
+ width: 1
+ }
+ }
+ box_data = [trace1, trace2, trace3]
+ } else {
+ var box_layout = {
+ width: 500,
+ height: 500,
+ margin: {
+ l: 50,
+ r: 30,
+ t: 30,
+ b: 80
+ }
+ };
+ box_data = [
+ {
+ type: 'box',
+ y: get_sample_vals(full_sample_lists[0]),
+ name: sample_group_list[0],
+ boxpoints: 'all',
+ jitter: 0.5,
+ whiskerwidth: 0.2,
+ fillcolor: 'cls',
+ marker: {
+ size: 2
+ },
+ line: {
+ width: 1
+ }
+ }
+ ]
+ }
+
+ obj = {
+ data: box_data,
+ layout: box_layout
+ }
+ Plotly.newPlot('box_plot', obj);
+
// Histogram
var hist_trace = {
x: get_sample_vals(sample_lists[0]),
@@ -686,50 +802,6 @@
root.bar_layout = layout
Plotly.newPlot('bar_chart', root.bar_data, layout)
- if (Object.keys(js_data.sample_group_types).length > 1) {
- full_sample_lists = [sample_lists[0], sample_lists[1], sample_lists[0].concat(sample_lists[1])]
- sample_group_list = [js_data.sample_group_types['samples_primary'], js_data.sample_group_types['samples_other'], js_data.sample_group_types['samples_all']]
- } else {
- full_sample_lists = [sample_lists[0]]
- sample_group_list = [js_data.sample_group_types['samples_primary']]
- }
-
- data = []
- for ( var i = 0; i < full_sample_lists.length; i ++ ) {
- var box_trace = {
- type: 'box',
- y: get_sample_vals(full_sample_lists[i]),
- name: sample_group_list[i],
- boxpoints: 'all',
- jitter: 0.5,
- whiskerwidth: 0.2,
- fillcolor: 'cls',
- marker: {
- size: 2
- },
- line: {
- width: 1
- }
- };
- data.push(box_trace)
- };
- layout = {
- title: 'Box Plot',
- yaxis: {
- autorange: true,
- showgrid: true,
- zeroline: true
- },
- margin: {
- l: 50,
- r: 30,
- t: 80,
- b: 80
- }
- };
-
- Plotly.newPlot('box_plot', data, layout);
-
$('.histogram_samples_group').val(root.stats_group);
$('.histogram_samples_group').change(function() {
root.stats_group = $(this).val();
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html
index 237a65f3..41bdaddc 100644
--- a/wqflask/wqflask/templates/base.html
+++ b/wqflask/wqflask/templates/base.html
@@ -77,6 +77,9 @@
{% endif %}
</li>
<li style="margin-left: 20px;">
+ <a href="http://gn2-guix.genenetwork.org" style="font-weight: bold;" >Use Staging Branch</a>
+ </li>
+ <li style="margin-left: 20px;">
<a href="http://www.genenetwork.org" style="font-weight: bold;" >Use GeneNetwork 1</a>
</li>
</ul>
diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html
index 08a934a6..fd083983 100644
--- a/wqflask/wqflask/templates/marker_regression_gn1.html
+++ b/wqflask/wqflask/templates/marker_regression_gn1.html
@@ -183,6 +183,13 @@
{% if selectedChr == -1 %}
<div class="container" style="padding-left: 30px; width:{% if 'additive' in trimmed_markers[0] %}45%{% else %}35%{% endif %};">
<h2>Mapping Statistics</h2>
+ <br />
+ <button class="btn btn-default" id="select_all"><span class="glyphicon glyphicon-ok"></span> Select All</button>
+ <button class="btn btn-default" id="deselect_all"><span class="glyphicon glyphicon-remove"></span> Deselect All</button>
+ <button class="btn btn-default" id="invert"><span class="glyphicon glyphicon-resize-vertical"></span> Invert</button>
+ <button class="btn btn-default" id="add" disabled><span class="glyphicon glyphicon-plus-sign"></span> Add</button>
+ <br />
+ <br />
<div id="table_container" style="border-style: solid; border-width: 1px; border-color: black;">
<table id="trait_table" class="table table-hover table-striped nowrap">
<thead>
@@ -211,7 +218,7 @@
<td align="center" style="padding-right: 0px;">
<input type="checkbox" name="selectCheck"
class="checkbox trait_checkbox"
- value="{{ marker.name }}">
+ value="{{ data_hmac('{}:{}Geno'.format(marker.name, dataset.group.name)) }}">
</td>
<td align="right">{{ loop.index }}</td>
<td>{% if geno_db_exists == "True" %}<a href="/show_trait?trait_id={{ marker.name }}&dataset={{ dataset.group.name }}Geno">{{ marker.name }}</a>{% else %}{{ marker.name }}{% endif %}</td>