diff options
-rwxr-xr-x | wqflask/wqflask/templates/correlation_page.html | 17 | ||||
-rw-r--r-- | wqflask/wqflask/templates/empty_collection.html | 15 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/show_trait.html | 2 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/show_trait_edit_data.html | 9 | ||||
-rwxr-xr-x | wqflask/wqflask/views.py | 73 |
5 files changed, 71 insertions, 45 deletions
diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 62407555..d44fd2d4 100755 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -26,6 +26,7 @@ <table id="corr_results" class="table table-hover table-striped"> <thead> <tr> + <th style="width: 30px;"></th> {% for header in target_dataset.header_fields %} {% if header == 'Max LRS' %} <th style="text-align: right;">Max <br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> @@ -78,10 +79,9 @@ <tbody> {% for trait in correlation_results %} <tr> - <TD>{{ loop.index }} - <INPUT TYPE="checkbox" NAME="result_trait" class="checkbox trait_checkbox" - VALUE="{{ data_hmac('{}:{}'.format(trait.name, target_dataset.name)) }}"> + <TD><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"> </TD> + <TD align="right">{{ loop.index }}</TD> <TD> <a href="{{ url_for('show_trait_page', trait_id = trait.name, @@ -211,6 +211,8 @@ console.time("Creating table"); {% if target_dataset.type == "ProbeSet" %} + + $('#corr_results').dataTable( { "columns": [ { "type": "natural" }, @@ -222,6 +224,7 @@ { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, + { "type": "natural" }, { "type": "numeric-html" }, { "type": "natural" }, { "type": "natural" }, @@ -231,15 +234,10 @@ ], "sDom": "RZtir", "iDisplayLength": -1, - "autoWidth": true, - "bLengthChange": true, "bDeferRender": true, "bSortClasses": false, //"scrollY": "700px", //"scrollCollapse": false, - "colResize": { - "tableWidthFixed": false - }, "paging": false } ); @@ -257,6 +255,7 @@ { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, + { "type": "natural" }, { "type": "numeric-html" }, { "type": "natural" }, { "type": "natural" } @@ -280,6 +279,7 @@ { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, + { "type": "natural" }, { "type": "numeric-html" }, { "type": "natural" }, { "type": "natural" } @@ -300,6 +300,7 @@ {% endif %} console.timeEnd("Creating table"); + }); </script> {% endblock %} diff --git a/wqflask/wqflask/templates/empty_collection.html b/wqflask/wqflask/templates/empty_collection.html new file mode 100644 index 00000000..3f2b3786 --- /dev/null +++ b/wqflask/wqflask/templates/empty_collection.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% block title %}{{ tool }}{% endblock %} +{% block content %} +<!-- Start of body --> + {{ header("Error") }} + + <div class="container"> + <input type="hidden" name="uc_id" id="uc_id" value="{{ uc_id }}"> + <p>You must select at least one trait to use the {{ tool }}.</p> + </div> + + +<!-- End of body --> + +{% endblock %} diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 0709a82f..55464635 100755 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -199,6 +199,7 @@ {% if sample_groups[0].se_exists() %} $('#samples_primary, #samples_other').DataTable( { "columns": [ + { "bSortable": false }, { "type": "natural" }, { "type": "natural" }, { "type": "cust-txt" }, @@ -228,6 +229,7 @@ $('#samples_primary, #samples_other').DataTable( { "columns": [ + { "bSortable": false }, { "type": "natural" }, null, { "type": "cust-txt" } diff --git a/wqflask/wqflask/templates/show_trait_edit_data.html b/wqflask/wqflask/templates/show_trait_edit_data.html index ca8e02de..d39df976 100755 --- a/wqflask/wqflask/templates/show_trait_edit_data.html +++ b/wqflask/wqflask/templates/show_trait_edit_data.html @@ -81,6 +81,7 @@ <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> @@ -98,13 +99,9 @@ <tbody> {% for sample in sample_type.sample_list %} <tr class="{{ sample.class_outlier }} value_se" id="{{ sample.this_id }}"> - <td class="column_name-Index"> - {{ loop.index }} - <input type="checkbox" name="selectCheck" - class="checkbox edit_sample_checkbox" - value="{{ sample.name }}" checked="checked"> + <td class="column_name-"><input type="checkbox" name="selectCheck" class="checkbox edit_sample_checkbox" style="transform: scale(1.5);" value="{{ sample.name }}" checked="checked"> </td> - + <td class="column_name-Index" align="right">{{ loop.index }}</td> <td class="column_name-Sample"> <span class="edit_sample_sample_name"> {{ sample.name }} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index cb7caf51..89302120 100755 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -277,38 +277,43 @@ def heatmap_page(): start_vars = request.form temp_uuid = uuid.uuid4() - version = "v5" - key = "heatmap:{}:".format(version) + json.dumps(start_vars, sort_keys=True) - print("key is:", pf(key)) - with Bench("Loading cache"): - result = Redis.get(key) + traits = [trait.strip() for trait in start_vars['trait_list'].split(',')] + if traits[0] != "": + version = "v5" + key = "heatmap:{}:".format(version) + json.dumps(start_vars, sort_keys=True) + print("key is:", pf(key)) + with Bench("Loading cache"): + result = Redis.get(key) - if result: - print("Cache hit!!!") - with Bench("Loading results"): - result = pickle.loads(result) + if result: + print("Cache hit!!!") + with Bench("Loading results"): + result = pickle.loads(result) - else: - print("Cache miss!!!") + else: + print("Cache miss!!!") - template_vars = heatmap.Heatmap(request.form, temp_uuid) - template_vars.js_data = json.dumps(template_vars.js_data, - default=json_default_handler, - indent=" ") + template_vars = heatmap.Heatmap(request.form, temp_uuid) + template_vars.js_data = json.dumps(template_vars.js_data, + default=json_default_handler, + indent=" ") - result = template_vars.__dict__ - - for item in template_vars.__dict__.keys(): - print(" ---**--- {}: {}".format(type(template_vars.__dict__[item]), item)) - - pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL) - print("pickled result length:", len(pickled_result)) - Redis.set(key, pickled_result) - Redis.expire(key, 60*60) + result = template_vars.__dict__ + + for item in template_vars.__dict__.keys(): + print(" ---**--- {}: {}".format(type(template_vars.__dict__[item]), item)) - with Bench("Rendering template"): - rendered_template = render_template("heatmap.html", **result) + pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL) + print("pickled result length:", len(pickled_result)) + Redis.set(key, pickled_result) + Redis.expire(key, 60*60) + with Bench("Rendering template"): + rendered_template = render_template("heatmap.html", **result) + + else: + rendered_template = render_template("empty_collection.html", **{'tool':'Heatmap'}) + return rendered_template @app.route("/mapping_results_container") @@ -481,12 +486,18 @@ def corr_compute_page(): @app.route("/corr_matrix", methods=('POST',)) def corr_matrix_page(): print("In corr_matrix, request.form is:", pf(request.form)) - template_vars = show_corr_matrix.CorrelationMatrix(request.form) - template_vars.js_data = json.dumps(template_vars.js_data, - default=json_default_handler, - indent=" ") + + start_vars = request.form + traits = [trait.strip() for trait in start_vars['trait_list'].split(',')] + if traits[0] != "": + template_vars = show_corr_matrix.CorrelationMatrix(start_vars) + template_vars.js_data = json.dumps(template_vars.js_data, + default=json_default_handler, + indent=" ") - return render_template("correlation_matrix.html", **template_vars.__dict__) + return render_template("correlation_matrix.html", **template_vars.__dict__) + else: + return render_template("empty_collection.html", **{'tool':'Correlation Matrix'}) @app.route("/corr_scatter_plot") def corr_scatter_plot_page(): |