From 913d2e9113635ccf53140d53aaad55f09fc1df26 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Mon, 3 May 2021 20:48:00 +0300 Subject: apply limit to for results --- wqflask/wqflask/correlation/correlation_gn3_api.py | 10 +++++----- wqflask/wqflask/views.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wqflask/wqflask/correlation/correlation_gn3_api.py b/wqflask/wqflask/correlation/correlation_gn3_api.py index b56c09d8..4949bbe2 100644 --- a/wqflask/wqflask/correlation/correlation_gn3_api.py +++ b/wqflask/wqflask/correlation/correlation_gn3_api.py @@ -11,7 +11,7 @@ from base.trait import retrieve_sample_data from gn3.computations.correlations import compute_all_sample_correlation from gn3.computations.correlations import map_shared_keys_to_values from gn3.computations.correlations import compute_all_lit_correlation -from gn3.computations.correlations import experimental_compute_all_tissue_correlation +from gn3.computations.correlations import compute_tissue_correlation from gn3.db_utils import database_connector @@ -76,7 +76,7 @@ def tissue_for_trait_lists(corr_results, this_dataset, this_trait): trait_name, symbol) in traits_symbol_dict.items() if trait_lists.get(trait_name)}) primary_tissue_data, target_tissue_data = get_tissue_correlation_input( this_trait, traits_symbol_dict) - corr_results = experimental_compute_all_tissue_correlation( + corr_results = compute_tissue_correlation( primary_tissue_dict=primary_tissue_data, target_tissues_data=target_tissue_data, corr_method="pearson") @@ -93,7 +93,7 @@ def compute_correlation(start_vars, method="pearson"): sample_data) = create_target_this_trait(start_vars) method = start_vars['corr_sample_method'] - _corr_return_results = start_vars.get("corr_return_results", 100) + corr_return_results = int(start_vars.get("corr_return_results", 100)) corr_input_data = {} if corr_type == "sample": @@ -121,7 +121,7 @@ def compute_correlation(start_vars, method="pearson"): "primary_tissue": primary_tissue_data, "target_tissues_dict": target_tissue_data } - correlation_results = experimental_compute_all_tissue_correlation( + correlation_results = compute_tissue_correlation( primary_tissue_dict=corr_input_data["primary_tissue"], target_tissues_data=corr_input_data[ "target_tissues_dict"], @@ -139,7 +139,7 @@ def compute_correlation(start_vars, method="pearson"): conn=conn, trait_lists=list(geneid_dict.items()), species=species, gene_id=this_trait_geneid) - return correlation_results + return correlation_results[0:corr_return_results] def do_lit_correlation(this_trait, this_dataset): diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 3d4376e2..b042a211 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -885,7 +885,7 @@ def corr_compute_page(): initial_time = time.time() correlation_results = compute_correlation(request.form) print(">>>>Time taken by this endpoint",time.time()-initial_time) - return render_template("test_correlation_page.html",correlation_results=correlation_results[0:50]) + return render_template("test_correlation_page.html",correlation_results=correlation_results) @app.route("/corr_matrix", methods=('POST',)) def corr_matrix_page(): -- cgit v1.2.3