From 92e0c8b492e96f5875bc2bb1df3e043abde2f280 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 3 Jul 2024 20:55:37 +0000 Subject: Add link to GeneCup to tool buttons This also includes a function for converting a list of traits/datasets to symbols, which was added to trait.py --- .../static/new/javascript/search_results.js | 2 +- gn2/wqflask/templates/tool_buttons.html | 4 ++++ gn2/wqflask/views.py | 24 ++++++++++++++++++---- 3 files changed, 25 insertions(+), 5 deletions(-) (limited to 'gn2/wqflask') diff --git a/gn2/wqflask/static/new/javascript/search_results.js b/gn2/wqflask/static/new/javascript/search_results.js index 29050c2b..c89b4ce3 100644 --- a/gn2/wqflask/static/new/javascript/search_results.js +++ b/gn2/wqflask/static/new/javascript/search_results.js @@ -309,7 +309,7 @@ $(function() { return submit_special("/loading") }); - $("#send_to_webgestalt, #send_to_bnw, #send_to_geneweaver").on("click", function() { + $("#send_to_webgestalt, #send_to_bnw, #send_to_geneweaver, #send_to_genecup").on("click", function() { traits = getTraitsFromTable() $("#trait_list").val(traits) url = $(this).data("url") diff --git a/gn2/wqflask/templates/tool_buttons.html b/gn2/wqflask/templates/tool_buttons.html index c6d1476c..3e716d70 100644 --- a/gn2/wqflask/templates/tool_buttons.html +++ b/gn2/wqflask/templates/tool_buttons.html @@ -18,6 +18,10 @@ BNW + + diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py index 5d8a56e5..daddb442 100644 --- a/gn2/wqflask/views.py +++ b/gn2/wqflask/views.py @@ -46,12 +46,12 @@ from gn2.wqflask import search_results from gn2.wqflask import server_side # Used by YAML in marker_regression from gn2.base.data_set import create_dataset +from gn2.base.trait import fetch_symbols from gn2.wqflask.show_trait import show_trait from gn2.wqflask.show_trait import export_trait_data from gn2.wqflask.show_trait.show_trait import get_diff_of_vals from gn2.wqflask.heatmap import heatmap -from gn2.wqflask.external_tools import send_to_bnw -from gn2.wqflask.external_tools import send_to_webgestalt +from gn2.wqflask.external_tools import send_to_bnw, send_to_webgestalt from gn2.wqflask.external_tools import send_to_geneweaver from gn2.wqflask.comparison_bar_chart import comparison_bar_chart from gn2.wqflask.marker_regression import run_mapping @@ -88,8 +88,8 @@ from gn2.utility.redis_tools import get_redis_conn import gn2.utility.hmac as hmac -from gn2.base.webqtlConfig import TMPDIR -from gn2.base.webqtlConfig import GENERATED_IMAGE_DIR +from gn2.base.webqtlConfig import TMPDIR, GENERATED_IMAGE_DIR +from gn2.base.webqtlConfig import GENE_CUP_URL from gn2.wqflask.database import database_connection @@ -749,6 +749,22 @@ def geneweaver_page(): return rendered_template +@app.route("/genecup", methods=('POST',)) +def genecup_page(): + start_vars = request.form + + traits = [trait.strip() for trait in start_vars['trait_list'].split(',')] + + if traits[0] != "": + symbol_string = fetch_symbols(traits) + return redirect(GENE_CUP_URL % symbol_string) + else: + rendered_template = render_template( + "empty_collection.html", **{'tool': 'GeneWeaver'}) + + return rendered_template + + @app.route("/comparison_bar_chart", methods=('POST',)) def comp_bar_chart_page(): start_vars = request.form -- cgit v1.2.3