aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2016-06-07 18:15:51 +0000
committerzsloan2016-06-07 18:15:51 +0000
commitf3396740863f6f64713a9c761d2bfd089785170d (patch)
treec207f1963bae8a770b4637db56a47763ff47ac5c
parent3bc5e361d135777c1c4cfc2cef5b6aca7a6fa984 (diff)
downloadgenenetwork2-f3396740863f6f64713a9c761d2bfd089785170d.tar.gz
R/qtl pair scan now works again, though it takes a while (10-15 minutes).
Added pop-up warning user about run-time for pair scan Fixed links to GN2 github on the index page Fixed a couple issues with the search result page text Changed the appearance of the trait sample data table to match other tables (darker headers, etc)
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression.py11
-rwxr-xr-xwqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js18
-rwxr-xr-xwqflask/wqflask/templates/index_page.html6
-rw-r--r--wqflask/wqflask/templates/pair_scan_results.html2
-rwxr-xr-xwqflask/wqflask/templates/search_result_page.html36
-rwxr-xr-xwqflask/wqflask/templates/show_trait_edit_data.html17
-rw-r--r--wqflask/wqflask/views.py66
7 files changed, 86 insertions, 70 deletions
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 1e0a618e..26da95b9 100644
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -37,7 +37,7 @@ from utility import temp_data
from utility.benchmark import Bench
from wqflask.marker_regression import gemma_mapping
-from utility.tools import locate, locate_ignore_error, PYLMM_COMMAND, GEMMA_COMMAND, PLINK_COMMAND
+from utility.tools import locate, locate_ignore_error, PYLMM_COMMAND, GEMMA_COMMAND, PLINK_COMMAND, TEMPDIR
from utility.external import shell
from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR
@@ -213,7 +213,8 @@ class MarkerRegression(object):
if 'lod_score' in marker.keys():
self.qtl_results.append(marker)
- self.trimmed_markers = trim_markers_for_table(results)
+
+ self.trimmed_markers = results
for qtl in enumerate(self.qtl_results):
self.json_data['chr1'].append(str(qtl['chr1']))
@@ -228,7 +229,7 @@ class MarkerRegression(object):
maf = self.maf,
manhattan_plot = self.manhattan_plot,
mapping_scale = self.mapping_scale,
- qtl_results = self.qtl_results,
+ qtl_results = self.qtl_results
)
else:
@@ -388,7 +389,7 @@ class MarkerRegression(object):
r_sum = ro.r["sum"] # Map the sum function
plot = ro.r["plot"] # Map the plot function
postscript = ro.r["postscript"] # Map the postscript function
- png = ro.r["png"] # Map the png function
+ png = ro.r["png"] # Map the png function
dev_off = ro.r["dev.off"] # Map the device off function
print(r_library("qtl")) # Load R/qtl
@@ -430,7 +431,7 @@ class MarkerRegression(object):
#print("Pair scan results:", result_data_frame)
self.pair_scan_filename = webqtlUtil.genRandStr("scantwo_") + ".png"
- png(file=TMPDIR+self.pair_scan_filename)
+ png(file=TEMPDIR+self.pair_scan_filename)
plot(result_data_frame)
dev_off()
diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
index 519d1304..3b1a1205 100755
--- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
@@ -135,6 +135,8 @@
outlier_text = "One or more outliers exist in this data set. Please review values before mapping. Including outliers when mapping may lead to misleading results. We recommend <A HREF=\"http://en.wikipedia.org/wiki/Winsorising\">winsorising</A> the outliers or simply deleting them.";
+ runtime_warning_text = "This function could take as long as 10-20 minutes to run, so please do not close your browser window until it finishes."
+
showalert = function(message, alerttype) {
return $('#alert_placeholder').append('<div id="alertdiv" class="alert ' + alerttype + '"><a class="close" data-dismiss="alert">�</a><span>' + message + '</span></div>');
};
@@ -187,8 +189,20 @@
$('input[name=do_control]').val($('input[name=do_control_rqtl]:checked').val());
form_data = $('#trait_data_form').serialize();
console.log("form_data is:", form_data);
- return submit_special(url);
- //return do_ajax_post(url, form_data);
+ if ($('input[name=pair_scan]:checked').val() == "true") {
+ console.log("PAIR SCAN:", $('input[name=pair_scan]:checked').val())
+ run_pair_scan = confirm(runtime_warning_text)
+ if (run_pair_scan == true) {
+ submit_special(url);
+ }
+ else {
+ return false
+ }
+ }
+ else {
+ return submit_special(url);
+ //return do_ajax_post(url, form_data);
+ }
};
})(this));
diff --git a/wqflask/wqflask/templates/index_page.html b/wqflask/wqflask/templates/index_page.html
index 5cc15682..9e029911 100755
--- a/wqflask/wqflask/templates/index_page.html
+++ b/wqflask/wqflask/templates/index_page.html
@@ -207,12 +207,12 @@
<li><a href="http://galaxy.genenetwork.org/" target="_blank">Galaxy</a> at
UTHSC</li>
- <li>GeneNetwork at <a href="http://ec2.genenetwork.org/" target="_blank">Amazon
+ <li>GeneNetwork 1 at <a href="http://ec2.genenetwork.org/" target="_blank">Amazon
Cloud (EC2)</a></li>
- <li>GeneNetwork Source Code at <a href="http://sourceforge.net/projects/genenetwork/" target="_blank">SourceForge</a></li>
+ <li>GeneNetwork 1 Source Code at <a href="http://sourceforge.net/projects/genenetwork/" target="_blank">SourceForge</a></li>
- <li>GeneNetwork Source Code at <a href="https://github.com/genenetwork/genenetwork" target="_blank">GitHub</a></li>
+ <li>GeneNetwork 2 Source Code at <a href="https://github.com/genenetwork/genenetwork2" target="_blank">GitHub</a></li>
</ul>
<h3>GN1 Mirror and development sites</h3>
diff --git a/wqflask/wqflask/templates/pair_scan_results.html b/wqflask/wqflask/templates/pair_scan_results.html
index ab4a36bb..1ccb2b27 100644
--- a/wqflask/wqflask/templates/pair_scan_results.html
+++ b/wqflask/wqflask/templates/pair_scan_results.html
@@ -44,7 +44,7 @@
</tr>
</thead>
<tbody>
- {% for marker in filtered_markers %}
+ {% for marker in trimmed_markers %}
<tr>
<td>{{loop.index}}</td>
<td>{{marker.name}}</td>
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index 4b4f3584..02c97862 100755
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -21,44 +21,30 @@
to find all records
{% for word in search_terms %}
{% if word.key|lower == "rif" %}
- with <u>GeneRIF</u> containing <strong>{{ word.search_term[0] }}</strong>{% if not loop.last %} and {% endif %}
+ with <u>GeneRIF</u> containing <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}.{% else %} and {% endif %}
{% elif word.key|lower == "go" %}
- with <u>Gene Ontology ID</u> <strong>{{ word.search_term[0] }}</strong>{% if not loop.last %} and {% endif %}
+ with <u>Gene Ontology ID</u> <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}.{% else %} and {% endif %}
{% elif word.key|lower == "wiki" %}
- with <u>GeneWiki</u> containing <strong>{{ word.search_term[0] }}</strong>{% if not loop.last %} and {% endif %}
+ with <u>GeneWiki</u> containing <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}.{% else %} and {% endif %}
{% elif word.key|lower == "mean" %}
- with <u>MEAN</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if not loop.last %} and {% endif %}
+ with <u>MEAN</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if loop.last %}.{% else %} and {% endif %}
{% elif word.key|lower == "lrs" or word.key|lower == "translrs" or word.key|lower == "cislrs" %}
{% if word.search_term|length == 1 %}
- with {% if word.key|lower == "translrs" %}trans{% elif word.key|lower == "cislrs" %}cis{% endif %}LRS {% if word.separator == ">" %} greater than {% elif word.separator == "<" %} less than {% elif word.separator == ">=" %} greater than or equal to {% elif word.separator == "<=" %} less than or equal to {% endif %} <strong>{{ word.search_term[0] }}</strong>{% if not loop.last %} and {% endif %}
+ with {% if word.key|lower == "translrs" %}trans{% elif word.key|lower == "cislrs" %}cis{% endif %}LRS {% if word.separator == ">" %} greater than {% elif word.separator == "<" %} less than {% elif word.separator == ">=" %} greater than or equal to {% elif word.separator == "<=" %} less than or equal to {% endif %} <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}.{% else %} and {% endif %}
{% elif word.search_term|length == 2 %}
- with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if not loop.last %} and {% endif %}
+ with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if loop.last %}.{% else %} and {% endif %}
{% elif word.search_term|length == 3 %}
- with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[2] }}</strong>{% if not loop.last %} and {% endif %}
+ with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[2] }}</strong>{% if loop.last %}.{% else %} and {% endif %}
{% elif word.search_term|length == 5 %}
- with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[2] }}</strong> between <strong>{{ word.search_term[3] }}</strong> and <strong>{{ word.search_term[4] }}</strong> Mb{% if not loop.last %} and {% endif %}
+ with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[2] }}</strong> between <strong>{{ word.search_term[3] }}</strong> and <strong>{{ word.search_term[4] }}</strong> Mb{% if loop.last %}.{% else %} and {% endif %}
{% endif %}
{% elif word.key|lower == "position" %}
- with <u>target genes</u> on chromosome <strong>{% if word.search_term[0].split('chr')|length > 1 %}{{ word.search_term[0].split('chr')[1] }}{% elif word.search_term[0].split('CHR')|length > 1 %}{{ word.search_term[0].split('CHR')[1] }}{% else %}{{ word.search_term[0] }}{% endif %}</strong> between <strong>{{ word.search_term[1] }}</strong> and <strong>{{ word.search_term[2] }}</strong> Mb{% if not loop.last %} and {% endif %}
+ with <u>target genes</u> on chromosome <strong>{% if word.search_term[0].split('chr')|length > 1 %}{{ word.search_term[0].split('chr')[1] }}{% elif word.search_term[0].split('CHR')|length > 1 %}{{ word.search_term[0].split('CHR')[1] }}{% else %}{{ word.search_term[0] }}{% endif %}</strong> between <strong>{{ word.search_term[1] }}</strong> and <strong>{{ word.search_term[2] }}</strong> Mb{% if loop.last %}.{% else %} and {% endif %}
{% else %}
- with {{ word.key|lower }} matching {{ word.search_term[0] }}
+ that match the term {{ word.search_term[0] }}.
{% endif %}
- <!--<strong>{{word.search_term[0]}}</strong> {% if not loop.last %} or {% endif %}-->
- {% endfor %}.
-
- </p>
-
- <!--
- <ul>
- {% if search_terms %}
- <li>
- {% for word in search_terms %}
- <strong>{{word.search_term[0]}}</strong> {% if not loop.last %} or {% endif %}
{% endfor %}
- </li>
- {% endif %}
- </ul>
- -->
+ </p>
<p>To study a record, click on its ID below. Check records below and click Add button to add to selection.</p>
diff --git a/wqflask/wqflask/templates/show_trait_edit_data.html b/wqflask/wqflask/templates/show_trait_edit_data.html
index 228ef362..ff5f0c87 100755
--- a/wqflask/wqflask/templates/show_trait_edit_data.html
+++ b/wqflask/wqflask/templates/show_trait_edit_data.html
@@ -77,20 +77,20 @@
{% for sample_type in sample_groups %}
<div class="sample_group" style="width:{{ trait_table_width }}%;">
<h3>{{ sample_type.header }}</h3>
-
+ <div id="table_container" style="background-color: #eeeeee; border: 1px solid black;">
<table class="table-hover table-striped" id="samples_{{ sample_type.sample_group_type }}" style="float: left;">
<thead>
<tr>
- <th></th>
- <th>Index</th>
- <th>Sample</th>
- <th>Value</th>
+ <th style="background-color: #eeeeee;"></th>
+ <th style="background-color: #eeeeee;">Index</th>
+ <th style="background-color: #eeeeee;">Sample</th>
+ <th style="background-color: #eeeeee;">Value</th>
{% if sample_type.se_exists() %}
- <th>&nbsp;</th>
- <th>SE</th>
+ <th style="background-color: #eeeeee;">&nbsp;</th>
+ <th style="background-color: #eeeeee;">SE</th>
{% endif %}
{% for attribute in sample_type.attributes|sort() %}
- <th>
+ <th style="background-color: #eeeeee;">
{{ sample_type.attributes[attribute].name }}
</th>
{% endfor %}
@@ -144,6 +144,7 @@
{% endfor %}
</tbody>
</table>
+ </div>
</div>
{% endfor %}
<!--</div>-->
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index b7fcfa1d..df1f77bc 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -457,33 +457,47 @@ def marker_regression_page():
result = template_vars.__dict__
- #for item in template_vars.__dict__.keys():
- # print(" ---**--- {}: {}".format(type(template_vars.__dict__[item]), item))
-
- gn1_template_vars = marker_regression_gn1.MarkerRegression(result).__dict__
-
- #qtl_length = len(result['js_data']['qtl_results'])
- #print("qtl_length:", qtl_length)
- pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL)
- #print("pickled result length:", len(pickled_result))
- Redis.set(key, pickled_result)
- Redis.expire(key, 1*60)
-
- with Bench("Rendering template"):
- if result['pair_scan'] == True:
- img_path = result['pair_scan_filename']
- print("img_path:", img_path)
- initial_start_vars = request.form
- print("initial_start_vars:", initial_start_vars)
- imgfile = open(TEMPDIR + '/' + img_path, 'rb')
- imgdata = imgfile.read()
- imgB64 = imgdata.encode("base64")
- bytesarray = array.array('B', imgB64)
- result['pair_scan_array'] = bytesarray
- rendered_template = render_template("pair_scan_results.html", **result)
+ if result['pair_scan']:
+ with Bench("Rendering template"):
+ img_path = result['pair_scan_filename']
+ print("img_path:", img_path)
+ initial_start_vars = request.form
+ print("initial_start_vars:", initial_start_vars)
+ imgfile = open(TEMPDIR + img_path, 'rb')
+ imgdata = imgfile.read()
+ imgB64 = imgdata.encode("base64")
+ bytesarray = array.array('B', imgB64)
+ result['pair_scan_array'] = bytesarray
+ rendered_template = render_template("pair_scan_results.html", **result)
else:
- #rendered_template = render_template("marker_regression.html", **result)
- rendered_template = render_template("marker_regression_gn1.html", **gn1_template_vars)
+ #for item in template_vars.__dict__.keys():
+ # print(" ---**--- {}: {}".format(type(template_vars.__dict__[item]), item))
+
+ gn1_template_vars = marker_regression_gn1.MarkerRegression(result).__dict__
+
+ pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL)
+ print("pickled result length:", len(pickled_result))
+ Redis.set(key, pickled_result)
+ Redis.expire(key, 1*60)
+
+ with Bench("Rendering template"):
+ rendered_template = render_template("marker_regression_gn1.html", **gn1_template_vars)
+
+ # with Bench("Rendering template"):
+ # if result['pair_scan'] == True:
+ # img_path = result['pair_scan_filename']
+ # print("img_path:", img_path)
+ # initial_start_vars = request.form
+ # print("initial_start_vars:", initial_start_vars)
+ # imgfile = open(TEMPDIR + '/' + img_path, 'rb')
+ # imgdata = imgfile.read()
+ # imgB64 = imgdata.encode("base64")
+ # bytesarray = array.array('B', imgB64)
+ # result['pair_scan_array'] = bytesarray
+ # rendered_template = render_template("pair_scan_results.html", **result)
+ # else:
+ # rendered_template = render_template("marker_regression.html", **result)
+ # rendered_template = render_template("marker_regression_gn1.html", **gn1_template_vars)
return rendered_template