diff options
author | Frederick Muriuki Muriithi | 2023-06-16 12:57:16 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-06-20 13:36:50 +0300 |
commit | 286027a1c07c0bf6ca113715f87ee7f1380d09e0 (patch) | |
tree | 927664a009db3ff11a912b906bb745e16ca8fb97 | |
parent | 883a7cba581f34eba48978746e2ff8bbb93020d8 (diff) | |
download | genenetwork2-286027a1c07c0bf6ca113715f87ee7f1380d09e0.tar.gz |
configs: Fix issues caught by mechanical-rob tests
-rw-r--r-- | wqflask/base/data_set/utils.py | 2 | ||||
-rw-r--r-- | wqflask/base/trait.py | 6 | ||||
-rw-r--r-- | wqflask/base/webqtlConfig.py | 1 | ||||
-rw-r--r-- | wqflask/scripts/corr_compute.py | 3 | ||||
-rw-r--r-- | wqflask/wqflask/correlation/rust_correlation.py | 14 | ||||
-rw-r--r-- | wqflask/wqflask/templates/correlation_error_page.html | 8 | ||||
-rw-r--r-- | wqflask/wqflask/templates/correlation_page.html | 28 | ||||
-rw-r--r-- | wqflask/wqflask/templates/loading.html | 6 | ||||
-rw-r--r-- | wqflask/wqflask/templates/loading_corrs.html | 6 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait_details.html | 4 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 2 |
11 files changed, 41 insertions, 39 deletions
diff --git a/wqflask/base/data_set/utils.py b/wqflask/base/data_set/utils.py index 465538af..11391d69 100644 --- a/wqflask/base/data_set/utils.py +++ b/wqflask/base/data_set/utils.py @@ -27,7 +27,7 @@ def query_table_timestamp(dataset_type: str): # computation data and actions with database_connection() as conn, conn.cursor() as cursor: - fetch_db_name = parse_db_url(get_setting("SQL_URI")) + fetch_db_name = parse_db_url(get_setting(app, "SQL_URI")) cursor.execute( "SELECT UPDATE_TIME FROM " "information_schema.tables " diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 70afa2cc..3a52e889 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -172,13 +172,13 @@ class GeneralTrait: alias = 'Not available' if self.symbol: human_response = requests.get( - get_setting("GN2_BASE_URL") + "gn3/gene/aliases/" + + get_setting(app, "GN2_BASE_URL") + "gn3/gene/aliases/" + self.symbol.upper()) mouse_response = requests.get( - get_setting("GN2_BASE_URL") + "gn3/gene/aliases/" + + get_setting(app, "GN2_BASE_URL") + "gn3/gene/aliases/" + self.symbol.capitalize()) other_response = requests.get( - get_setting("GN2_BASE_URL") + "gn3/gene/aliases/" + + get_setting(app, "GN2_BASE_URL") + "gn3/gene/aliases/" + self.symbol.lower()) if human_response and mouse_response and other_response: diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py index 296bd314..600c6800 100644 --- a/wqflask/base/webqtlConfig.py +++ b/wqflask/base/webqtlConfig.py @@ -93,6 +93,7 @@ def init_app(app): TEMPDIR, child) WEBQTL_TMPDIR = mkdir_with_temp_dir("/gn2/") app.config["WEBQTL_TMPDIR"] = WEBQTL_TMPDIR + app.config["TMPDIR"] = WEBQTL_TMPDIR app.config["WEBQTL_CACHEDIR"] = mkdir_with_temp_dir( f"{WEBQTL_TMPDIR}cache/") diff --git a/wqflask/scripts/corr_compute.py b/wqflask/scripts/corr_compute.py index c98a66a4..c55559cd 100644 --- a/wqflask/scripts/corr_compute.py +++ b/wqflask/scripts/corr_compute.py @@ -8,7 +8,8 @@ import datetime from flask import g -from wqflask import app +from gn2_main import app + from wqflask.user_session import UserSession from wqflask.correlation.show_corr_results import set_template_vars from wqflask.correlation.correlation_gn3_api import compute_correlation diff --git a/wqflask/wqflask/correlation/rust_correlation.py b/wqflask/wqflask/correlation/rust_correlation.py index cd3af26f..1285b740 100644 --- a/wqflask/wqflask/correlation/rust_correlation.py +++ b/wqflask/wqflask/correlation/rust_correlation.py @@ -32,7 +32,7 @@ def query_probes_metadata(dataset, trait_list): if not bool(trait_list) or dataset.type != "ProbeSet": return [] - with database_connection(get_setting("SQL_URI")) as conn: + with database_connection(get_setting(app, "SQL_URI")) as conn: with conn.cursor() as cursor: query = """ @@ -108,7 +108,7 @@ def chunk_dataset(dataset, steps, name): ProbeSetXRef.ProbeSetId = ProbeSet.Id """.format(name) - with database_connection(get_setting("SQL_URI")) as conn: + with database_connection(get_setting(app, "SQL_URI")) as conn: with conn.cursor() as curr: curr.execute(query) traits_name_dict = dict(curr.fetchall()) @@ -132,7 +132,7 @@ def compute_top_n_sample(start_vars, dataset, trait_list): sample_data=json.loads(samples_vals), dataset_samples=dataset.group.all_samples_ordered()) - with database_connection(get_setting("SQL_URI")) as conn: + with database_connection(get_setting(app, "SQL_URI")) as conn: with conn.cursor() as curr: curr.execute( """ @@ -150,7 +150,7 @@ def compute_top_n_sample(start_vars, dataset, trait_list): if len(trait_list) == 0: return {} - with database_connection(get_setting("SQL_URI")) as conn: + with database_connection(get_setting(app, "SQL_URI")) as conn: with conn.cursor() as curr: # fetching strain data in bulk query = ( @@ -186,7 +186,7 @@ def compute_top_n_lit(corr_results, target_dataset, this_trait) -> dict: geneid_dict = {trait_name: geneid for (trait_name, geneid) in geneid_dict.items() if corr_results.get(trait_name)} - with database_connection(get_setting("SQL_URI")) as conn: + with database_connection(get_setting(app, "SQL_URI")) as conn: return reduce( lambda acc, corr: {**acc, **corr}, compute_all_lit_correlation( @@ -260,7 +260,7 @@ def __compute_sample_corr__( return {} if target_dataset.type == "ProbeSet" and start_vars.get("use_cache") == "true": - with database_connection(get_setting("SQL_URI")) as conn: + with database_connection(get_setting(app, "SQL_URI")) as conn: file_path = fetch_text_file(target_dataset.name, conn) if file_path: (sample_vals, target_data) = read_text_file( @@ -341,7 +341,7 @@ def __compute_lit_corr__( (this_trait_geneid, geneid_dict, species) = do_lit_correlation( this_trait, target_dataset) - with database_connection(get_setting("SQL_URI")) as conn: + with database_connection(get_setting(app, "SQL_URI")) as conn: return reduce( lambda acc, lit: {**acc, **lit}, compute_all_lit_correlation( diff --git a/wqflask/wqflask/templates/correlation_error_page.html b/wqflask/wqflask/templates/correlation_error_page.html index 7d11daf0..34f4c601 100644 --- a/wqflask/wqflask/templates/correlation_error_page.html +++ b/wqflask/wqflask/templates/correlation_error_page.html @@ -2,10 +2,10 @@ {%block title%}Correlation Results{%endblock%} {%block css%} -<link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='DataTables/css/jquery.dataTables.css') }}" /> -<link rel="stylesheet" type="text/css" href="{{ url_for('js', filename='DataTablesExtensions/buttonsBootstrap/css/buttons.bootstrap.css') }}" /> -<link rel="stylesheet" type="text/css" href="{{ url_for('js', filename='DataTablesExtensions/buttonStyles/css/buttons.dataTables.min.css') }}" /> -<link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='fontawesome/css/all.min.css') }}"/> +<link rel="stylesheet" type="text/css" href="{{ url_for('toplevel.main_views.css', filename='DataTables/css/jquery.dataTables.css') }}" /> +<link rel="stylesheet" type="text/css" href="{{ url_for('toplevel.main_views.js', filename='DataTablesExtensions/buttonsBootstrap/css/buttons.bootstrap.css') }}" /> +<link rel="stylesheet" type="text/css" href="{{ url_for('toplevel.main_views.js', filename='DataTablesExtensions/buttonStyles/css/buttons.dataTables.min.css') }}" /> +<link rel="stylesheet" type="text/css" href="{{ url_for('toplevel.main_views.css', filename='fontawesome/css/all.min.css') }}"/> <link rel="stylesheet" type="text/css" href="/static/new/css/trait_list.css" /> <link rel="stylesheet" type="text/css" href="/static/new/css/show_trait.css" /> {%endblock%} diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 84fa4648..70b996db 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -1,10 +1,10 @@ {% extends "base.html" %} {% block title %}Correlation Results{% endblock %} {% block css %} - <link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='DataTables/css/jquery.dataTables.css') }}" /> - <link rel="stylesheet" type="text/css" href="{{ url_for('js', filename='DataTablesExtensions/buttonsBootstrap/css/buttons.bootstrap.css') }}" /> - <link rel="stylesheet" type="text/css" href="{{ url_for('js', filename='DataTablesExtensions/buttonStyles/css/buttons.dataTables.min.css') }}"> - <link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='fontawesome/css/all.min.css') }}"/> + <link rel="stylesheet" type="text/css" href="{{ url_for('toplevel.main_views.css', filename='DataTables/css/jquery.dataTables.css') }}" /> + <link rel="stylesheet" type="text/css" href="{{ url_for('toplevel.main_views.js', filename='DataTablesExtensions/buttonsBootstrap/css/buttons.bootstrap.css') }}" /> + <link rel="stylesheet" type="text/css" href="{{ url_for('toplevel.main_views.js', filename='DataTablesExtensions/buttonStyles/css/buttons.dataTables.min.css') }}"> + <link rel="stylesheet" type="text/css" href="{{ url_for('toplevel.main_views.css', filename='fontawesome/css/all.min.css') }}"/> <link rel="stylesheet" type="text/css" href="/static/new/css/trait_list.css" /> <link rel="stylesheet" type="text/css" href="/static/new/css/show_trait.css" /> {% endblock %} @@ -131,16 +131,16 @@ {% endblock %} {% block js %} - <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='js_alt/md5.min.js') }}"></script> - <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='js_alt/underscore.min.js') }}"></script> - <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='jszip/jszip.min.js') }}"></script> - <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='js_alt/underscore.min.js') }}"></script> - <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTables/js/jquery.dataTables.min.js') }}"></script> - <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/buttons/js/dataTables.buttons.min.js') }}"></script> - <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/buttons/js/buttons.html5.min.js') }}"></script> - <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/plugins/sorting/natural.js') }}"></script> - <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='fontawesome/js/all.min.js') }}"></script> - <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/scroller/js/dataTables.scroller.min.js') }}"></script> + <script language="javascript" type="text/javascript" src="{{ url_for('toplevel.main_views.js', filename='js_alt/md5.min.js') }}"></script> + <script language="javascript" type="text/javascript" src="{{ url_for('toplevel.main_views.js', filename='js_alt/underscore.min.js') }}"></script> + <script language="javascript" type="text/javascript" src="{{ url_for('toplevel.main_views.js', filename='jszip/jszip.min.js') }}"></script> + <script language="javascript" type="text/javascript" src="{{ url_for('toplevel.main_views.js', filename='js_alt/underscore.min.js') }}"></script> + <script language="javascript" type="text/javascript" src="{{ url_for('toplevel.main_views.js', filename='DataTables/js/jquery.dataTables.min.js') }}"></script> + <script language="javascript" type="text/javascript" src="{{ url_for('toplevel.main_views.js', filename='DataTablesExtensions/buttons/js/dataTables.buttons.min.js') }}"></script> + <script language="javascript" type="text/javascript" src="{{ url_for('toplevel.main_views.js', filename='DataTablesExtensions/buttons/js/buttons.html5.min.js') }}"></script> + <script language="javascript" type="text/javascript" src="{{ url_for('toplevel.main_views.js', filename='DataTablesExtensions/plugins/sorting/natural.js') }}"></script> + <script language="javascript" type="text/javascript" src="{{ url_for('toplevel.main_views.js', filename='fontawesome/js/all.min.js') }}"></script> + <script language="javascript" type="text/javascript" src="{{ url_for('toplevel.main_views.js', filename='DataTablesExtensions/scroller/js/dataTables.scroller.min.js') }}"></script> <script type="text/javascript" src="/static/new/javascript/search_results.js"></script> <script type="text/javascript" src="/static/new/javascript/table_functions.js"></script> <script type="text/javascript" src="/static/new/javascript/create_datatable.js"></script> diff --git a/wqflask/wqflask/templates/loading.html b/wqflask/wqflask/templates/loading.html index a6d9ae5e..35a58586 100644 --- a/wqflask/wqflask/templates/loading.html +++ b/wqflask/wqflask/templates/loading.html @@ -1,5 +1,5 @@ <title>Loading {{ start_vars.tool_used }} Results</title> -<link REL="stylesheet" TYPE="text/css" href="{{ url_for('css', filename='bootstrap/css/bootstrap.css') }}" /> +<link REL="stylesheet" TYPE="text/css" href="{{ url_for('toplevel.main_views.css', filename='bootstrap/css/bootstrap.css') }}" /> <link REL="stylesheet" TYPE="text/css" href="/static/new/css/bootstrap-custom.css" /> <form method="post" action="" name="loading_form" id="loading_form" class="form-horizontal"> {% for key, value in start_vars.items() %} @@ -100,8 +100,8 @@ </div> </div> </form> -<script src="{{ url_for('js', filename='jquery/jquery.min.js') }}" type="text/javascript"></script> -<script src="{{ url_for('js', filename='bootstrap/js/bootstrap.min.js') }}" type="text/javascript"></script> +<script src="{{ url_for('toplevel.main_views.js', filename='jquery/jquery.min.js') }}" type="text/javascript"></script> +<script src="{{ url_for('toplevel.main_views.js', filename='bootstrap/js/bootstrap.min.js') }}" type="text/javascript"></script> <script type="text/javascript"> $('#show_full_diff').click(function() { if ($('#diff_table_container').is(':visible')){ diff --git a/wqflask/wqflask/templates/loading_corrs.html b/wqflask/wqflask/templates/loading_corrs.html index 8abd5464..4772b8ce 100644 --- a/wqflask/wqflask/templates/loading_corrs.html +++ b/wqflask/wqflask/templates/loading_corrs.html @@ -8,7 +8,7 @@ <meta http-equiv="refresh" content="5"> <link rel="stylesheet" type="text/css" - href="{{url_for('css', filename='bootstrap/css/bootstrap.css')}}" /> + href="{{url_for('toplevel.main_views.css', filename='bootstrap/css/bootstrap.css')}}" /> <link rel="stylesheet" type="text/css" href="/static/new/css/bootstrap-custom.css" /> </head> @@ -21,8 +21,8 @@ </div> </div> - <script src="{{ url_for('js', filename='jquery/jquery.min.js') }}" type="text/javascript"></script> - <script src="{{ url_for('js', filename='bootstrap/js/bootstrap.min.js') }}" type="text/javascript"></script> + <script src="{{ url_for('toplevel.main_views.js', filename='jquery/jquery.min.js') }}" type="text/javascript"></script> + <script src="{{ url_for('toplevel.main_views.js', filename='bootstrap/js/bootstrap.min.js') }}" type="text/javascript"></script> </body> </html> diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index c745fce8..e8cedb95 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -63,7 +63,7 @@ {{ dataset.fullname }} </a> <br/> - <a href="{{ url_for('get_dataset', name=dataset.name) }}" target="_blank"> + <a href="{{ url_for('toplevel.main_views.get_dataset', name=dataset.name) }}" target="_blank"> GN2 Link: {{ dataset.fullname }} </a> </td> @@ -229,7 +229,7 @@ {% endif %} {% if this_trait.symbol != None %} <button type="button" class="btn btn-default" title="Write or review comments about this gene" onclick="window.open('http://gn1.genenetwork.org/webqtl/main.py?FormID=geneWiki&symbol={{ this_trait.symbol }}', '_blank')">(GN1) GeneWiki</button> - <button type="button" class="btn btn-default" title="Write or review comments about this gene" onclick="window.open('{{ url_for('display_generif_page', symbol=this_trait.symbol) }}', '_blank')">(GN2) GeneWiki</button> + <button type="button" class="btn btn-default" title="Write or review comments about this gene" onclick="window.open('{{ url_for('toplevel.main_views.display_generif_page', symbol=this_trait.symbol) }}', '_blank')">(GN2) GeneWiki</button> {% if dataset.group.species == "mouse" or dataset.group.species == "rat" %} <button type="button" class="btn btn-default" title="View SNPs and Indels" onclick="window.open('/snp_browser?first_run=true&species={{ dataset.group.species }}&gene_name={{ this_trait.symbol }}&limit_strains=on', '_blank')">SNPs</button> {% endif %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 689e3436..95019219 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -876,7 +876,7 @@ def corr_compute_page(): }) jobs.run(job_id, get_setting(app, "REDIS_URL")) - return redirect(url_for("corr_compute_page", job_id=str(job_id))) + return redirect(url_for("toplevel.main_views.corr_compute_page", job_id=str(job_id))) job = jobs.job( rconn, UUID(request.args.get("job_id"))).maybe( |