diff options
-rw-r--r-- | wqflask/wqflask/marker_regression/display_mapping_results.py | 16 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/search_results.js | 49 | ||||
-rw-r--r-- | wqflask/wqflask/templates/collections/view.html | 1 | ||||
-rw-r--r-- | wqflask/wqflask/templates/corr_scatterplot.html | 108 | ||||
-rw-r--r-- | wqflask/wqflask/templates/correlation_matrix.html | 2 | ||||
-rw-r--r-- | wqflask/wqflask/user_session.py | 14 |
6 files changed, 106 insertions, 84 deletions
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index bda899fb..d4b8a8dd 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -2013,9 +2013,17 @@ class DisplayMappingResults(object): LRSLODFont=ImageFont.truetype(font=VERDANA_FILE, size=int(18*zoom*1.5)) yZero = yTopOffset + plotHeight - LRSHeightThresh = drawAreaHeight - AdditiveHeightThresh = drawAreaHeight/2 - DominanceHeightThresh = drawAreaHeight/2 + # LRSHeightThresh = drawAreaHeight + # AdditiveHeightThresh = drawAreaHeight/2 + # DominanceHeightThresh = drawAreaHeight/2 + if self.selectedChr == 1: + LRSHeightThresh = drawAreaHeight - yTopOffset + 30*(zoom - 1) + AdditiveHeightThresh = LRSHeightThresh/2 + DominanceHeightThresh = LRSHeightThresh/2 + else: + LRSHeightThresh = drawAreaHeight + AdditiveHeightThresh = drawAreaHeight/2 + DominanceHeightThresh = drawAreaHeight/2 # LRSHeightThresh = (yZero - yTopOffset + 30*(zoom - 1)) # AdditiveHeightThresh = LRSHeightThresh/2 # DominanceHeightThresh = LRSHeightThresh/2 @@ -2251,7 +2259,7 @@ class DisplayMappingResults(object): startPosX += newStartPosX oldStartPosX = newStartPosX - #ZS: This is beause the chromosome value stored in qtlresult['chr'] can be (for example) either X or 20 depending upon the mapping method/scale used + #ZS: This is because the chromosome value stored in qtlresult['chr'] can be (for example) either X or 20 depending upon the mapping method/scale used this_chr = str(self.ChrList[self.selectedChr][0]) if self.plotScale != "physic": this_chr = str(self.ChrList[self.selectedChr][1]+1) diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index b3ed06fc..16eff345 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -138,14 +138,14 @@ $(function() { }; submit_bnw = function() { - trait_data = get_traits_from_table("trait_table", "submit_bnw") + trait_data = submit_traits_to_export_or_bnw("trait_table", "submit_bnw") } export_traits = function() { - trait_data = get_traits_from_table("trait_table", "export_csv") + trait_data = submit_traits_to_export_or_bnw("trait_table", "export_csv") }; - get_traits_from_table = function(table_name, destination) { + submit_traits_to_export_or_bnw = function(table_name, destination) { trait_table = $('#'+table_name); table_dict = {}; @@ -181,55 +181,58 @@ $(function() { $('#export_form').submit(); }; - $("#corr_matrix").on("click", function() { - traits = $("#trait_table input:checked").map(function() { + get_traits_from_table = function(){ + traits = $("#trait_table input:checked").map(function() { + return $(this).val(); + }).get(); + if (traits.length == 0){ + num_traits = $("#trait_table input").length + if (num_traits <= 100){ + traits = $("#trait_table input").map(function() { return $(this).val(); - }).get(); + }).get(); + } + } + return traits + } + + $("#corr_matrix").on("click", function() { + traits = get_traits_from_table() $("#trait_list").val(traits) $("input[name=tool_used]").val("Correlation Matrix") $("input[name=form_url]").val($(this).data("url")) return submit_special("/loading") }); $("#network_graph").on("click", function() { - traits = $("#trait_table input:checked").map(function() { - return $(this).val(); - }).get(); + traits = get_traits_from_table() $("#trait_list").val(traits) $("input[name=tool_used]").val("Network Graph") $("input[name=form_url]").val($(this).data("url")) return submit_special("/loading") }); $("#wgcna_setup").on("click", function() { - traits = $("#trait_table input:checked").map(function() { - return $(this).val(); - }).get(); + traits = get_traits_from_table() $("#trait_list").val(traits) $("input[name=tool_used]").val("WGCNA Setup") $("input[name=form_url]").val($(this).data("url")) return submit_special("/loading") }); $("#ctl_setup").on("click", function() { - traits = $("#trait_table input:checked").map(function() { - return $(this).val(); - }).get(); + traits = get_traits_from_table() $("#trait_list").val(traits) $("input[name=tool_used]").val("CTL Setup") $("input[name=form_url]").val($(this).data("url")) return submit_special("/loading") }); $("#heatmap").on("click", function() { - traits = $("#trait_table input:checked").map(function() { - return $(this).val(); - }).get(); + traits = get_traits_from_table() $("#trait_list").val(traits) $("input[name=tool_used]").val("Heatmap") $("input[name=form_url]").val($(this).data("url")) return submit_special("/loading") }); $("#comp_bar_chart").on("click", function() { - traits = $("#trait_table input:checked").map(function() { - return $(this).val(); - }).get(); + traits = get_traits_from_table() $("#trait_list").val(traits) $("input[name=tool_used]").val("Comparison Bar Chart") $("input[name=form_url]").val($(this).data("url")) @@ -237,9 +240,7 @@ $(function() { }); $("#send_to_webgestalt, #send_to_bnw, #send_to_geneweaver").on("click", function() { - traits = $("#trait_table input:checked").map(function() { - return $(this).val(); - }).get(); + traits = get_traits_from_table() $("#trait_list").val(traits) url = $(this).data("url") return submit_special(url) diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index f69df00a..5c8edab8 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -72,6 +72,7 @@ <br /> <form id="export_form" method="POST" action="/export_traits_csv"> <button class="btn btn-default" id="select_all" type="button"><span class="glyphicon glyphicon-ok"></span> Select All</button> + <button class="btn btn-default" id="invert" type="button"><span class="glyphicon glyphicon-ok"></span> Invert</button> <button class="btn" id="add" disabled="disabled" type="button"><i class="icon-plus-sign"></i> Copy</button> <input type="hidden" name="database_name" id="database_name" value="None"> <input type="hidden" name="export_data" id="export_data" value=""> diff --git a/wqflask/wqflask/templates/corr_scatterplot.html b/wqflask/wqflask/templates/corr_scatterplot.html index fca348d8..4739b467 100644 --- a/wqflask/wqflask/templates/corr_scatterplot.html +++ b/wqflask/wqflask/templates/corr_scatterplot.html @@ -132,44 +132,8 @@ <br> <div id="scatterplot2"></div> <br> - <div class="row" style="min-width: 700px; overflow: hidden;"> - <div style="float: left;"> - <table class="table table-hover table-striped table-bordered" style="width: 80%; margin-left: 60px; text-align: right;"> - <thead> - <tr><th style="text-align: right;">Statistic</th><th style="text-align: right;">Value</th></tr> - </thead> - <tbody> - <tr> - <td>Number</td> - <td>{{jsdata.num_overlap}}</td> - </tr> - <tr> - <td>Slope</td> - <td>{{ jsdata.slope_string }}</td> - </tr> - <tr> - <td>Intercept</td> - <td>{{'%0.3f' % jsdata.intercept}}</td> - </tr> - <tr> - <td>r value</td> - <td>{{'%0.3f' % jsdata.r_value}}</td> - </tr> - <tr> - <td>P value</td> - <td>{% if jsdata.p_value < 0.001 %}{{'%0.3e' % jsdata.p_value}}{% else %}{{'%0.3f' % jsdata.p_value}}{% endif %}</td> - </tr> - <tr> - <td style="text-align: left;" colspan="2"> - Regression Line - <br> - y = {{ jsdata.slope_string }} * x {% if jsdata.intercept < 0 %}- {{'%0.3f' % (jsdata.intercept * -1)}}{% else %}+ {{'%0.3f' % jsdata.intercept}}{% endif %} - </td> - </tr> - </tbody> - </table> - </div> - <div style="margin-left: 50px; min-width: 300px; float: left;"> + <div style="min-width: 700px; overflow: hidden;"> + <div style="margin-left: 50px; min-width: 300px;"> {% if trait_1.dataset.type == "ProbeSet" %} <div> X axis: @@ -240,15 +204,7 @@ </div> {% endif %} </div> - </div> - </div> - - <div class="tab-pane" id="tp2"> - <br> - <div id="srscatterplot2"></div> - <br> - <div class="row" style="min-width: 700px; overflow: hidden;"> - <div style="float: left;"> + <div style="float: left; margin-top:30px;"> <table class="table table-hover table-striped table-bordered" style="width: 80%; margin-left: 60px; text-align: right;"> <thead> <tr><th style="text-align: right;">Statistic</th><th style="text-align: right;">Value</th></tr> @@ -260,31 +216,39 @@ </tr> <tr> <td>Slope</td> - <td>{{ jsdata.srslope_string }}</td> + <td>{{ jsdata.slope_string }}</td> </tr> <tr> <td>Intercept</td> - <td>{{'%0.3f' % jsdata.srintercept}}</td> + <td>{{'%0.3f' % jsdata.intercept}}</td> </tr> <tr> <td>r value</td> - <td>{{'%0.3f' % jsdata.srr_value}}</td> + <td>{{'%0.3f' % jsdata.r_value}}</td> </tr> - <tr> + <tr> <td>P value</td> - <td>{% if jsdata.srp_value < 0.001 %}{{'%0.3e' % jsdata.srp_value}}{% else %}{{'%0.3f' % jsdata.srp_value}}{% endif %}</td> + <td>{% if jsdata.p_value < 0.001 %}{{'%0.3e' % jsdata.p_value}}{% else %}{{'%0.3f' % jsdata.p_value}}{% endif %}</td> </tr> <tr> <td style="text-align: left;" colspan="2"> Regression Line <br> - y = {{ jsdata.srslope_string }} * x {% if jsdata.srintercept < 0 %}- {{'%0.3f' % (jsdata.srintercept * -1)}}{% else %}+ {{'%0.3f' % jsdata.srintercept}}{% endif %} + y = {{ jsdata.slope_string }} * x {% if jsdata.intercept < 0 %}- {{'%0.3f' % (jsdata.intercept * -1)}}{% else %}+ {{'%0.3f' % jsdata.intercept}}{% endif %} </td> </tr> </tbody> </table> + </div> </div> - <div style="margin-left: 50px; min-width: 300px; float: left;"> + </div> + + <div class="tab-pane" id="tp2"> + <br> + <div id="srscatterplot2"></div> + <br> + <div class="row" style="min-width: 700px; overflow: hidden;"> + <div style="margin-left: 50px; min-width: 300px;"> {% if trait_1.dataset.type == "ProbeSet" %} <div> X axis: @@ -335,6 +299,42 @@ </div> {% endif %} </div> + <div style="float: left; margin-top: 30px;"> + <table class="table table-hover table-striped table-bordered" style="width: 80%; margin-left: 60px; text-align: right;"> + <thead> + <tr><th style="text-align: right;">Statistic</th><th style="text-align: right;">Value</th></tr> + </thead> + <tbody> + <tr> + <td>Number</td> + <td>{{jsdata.num_overlap}}</td> + </tr> + <tr> + <td>Slope</td> + <td>{{ jsdata.srslope_string }}</td> + </tr> + <tr> + <td>Intercept</td> + <td>{{'%0.3f' % jsdata.srintercept}}</td> + </tr> + <tr> + <td>r value</td> + <td>{{'%0.3f' % jsdata.srr_value}}</td> + </tr> + <tr> + <td>P value</td> + <td>{% if jsdata.srp_value < 0.001 %}{{'%0.3e' % jsdata.srp_value}}{% else %}{{'%0.3f' % jsdata.srp_value}}{% endif %}</td> + </tr> + <tr> + <td style="text-align: left;" colspan="2"> + Regression Line + <br> + y = {{ jsdata.srslope_string }} * x {% if jsdata.srintercept < 0 %}- {{'%0.3f' % (jsdata.srintercept * -1)}}{% else %}+ {{'%0.3f' % jsdata.srintercept}}{% endif %} + </td> + </tr> + </tbody> + </table> + </div> </div> </div> diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index cb9fb815..4e17a0b2 100644 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -36,7 +36,7 @@ <td align="center"><input type="checkbox" class="checkbox" style="margin-left: 3px; margin-right: 1px;"></td> <td align="right" style="padding-right: 4px;" > <a href="/show_trait?trait_id={{ trait.name }}&dataset={{ trait.dataset.name }}"><font style="font-size: 14px; font-style: Bold;"><b>Trait {{ loop.index }}: {{ trait.dataset.name }} {{ trait.name }}</b></font></a> - <div class="shortName" style="display:none">{% if trait.dataset.type == "ProbeSet" %}Gene Symbol: {{ trait.symbol }}{% elif trait.dataset.type == "Publish" %}Trait Symbol: {{ trait.post_publication_abbreviation }}{% elif trait.dataset.type == "Geno" %}Genotype{% endif %} </div> + <div class="shortName">{% if trait.dataset.type == "ProbeSet" %}Gene Symbol: {{ trait.symbol }}{% elif trait.dataset.type == "Publish" %}Trait Symbol: {{ trait.post_publication_abbreviation }}{% elif trait.dataset.type == "Geno" %}Genotype{% endif %} </div> <div class="verboseName" style="display: none;"> {% if trait.dataset.type == "ProbeSet" %} <div>{{ trait.symbol }} on Chr {{ trait.chr }} @ {{ trait.mb }} Mb</div><div>{{ trait.description }}</div><div>{{ trait.probe_target_description }}</div> diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py index ba659fe5..3aa2c151 100644 --- a/wqflask/wqflask/user_session.py +++ b/wqflask/wqflask/user_session.py @@ -13,7 +13,7 @@ from wqflask import app from utility import hmac #from utility.elasticsearch_tools import get_elasticsearch_connection -from utility.redis_tools import get_redis_conn, get_user_id, get_user_collections, save_collections +from utility.redis_tools import get_redis_conn, get_user_id, get_user_by_unique_column, set_user_attribute, get_user_collections, save_collections Redis = get_redis_conn() from utility.logger import getLogger @@ -53,6 +53,18 @@ def create_signed_cookie(): logger.debug("uuid_signed:", uuid_signed) return the_uuid, uuid_signed +@app.route("/user/manage", methods=('GET','POST')) +def manage_user(): + params = request.form if request.form else request.args + if 'new_full_name' in params: + set_user_attribute(g.user_session.user_id, 'full_name', params['new_full_name']) + if 'new_organization' in params: + set_user_attribute(g.user_session.user_id, 'organization', params['new_organization']) + + user_details = get_user_by_unique_column("user_id", g.user_session.user_id) + + return render_template("admin/manage_user.html", user_details = user_details) + class UserSession(object): """Logged in user handling""" |