diff options
author | Alexander_Kabui | 2022-09-20 15:56:54 +0300 |
---|---|---|
committer | Alexander_Kabui | 2022-09-20 16:14:44 +0300 |
commit | 3458808a65d5e55644ea23aa00982973230ac556 (patch) | |
tree | 2de48ac76b4e1a25e04246f51ff14e29f4db2d69 | |
parent | 628cbe8f4dae4e3f7f91e135943d17e8be427eb2 (diff) | |
download | genenetwork2-3458808a65d5e55644ea23aa00982973230ac556.tar.gz |
integrate use of text files
-rw-r--r-- | wqflask/wqflask/correlation/rust_correlation.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/wqflask/wqflask/correlation/rust_correlation.py b/wqflask/wqflask/correlation/rust_correlation.py index 5b39c871..d9193459 100644 --- a/wqflask/wqflask/correlation/rust_correlation.py +++ b/wqflask/wqflask/correlation/rust_correlation.py @@ -10,6 +10,7 @@ from wqflask.correlation.correlation_gn3_api import lit_for_trait_list from wqflask.correlation.correlation_gn3_api import do_lit_correlation from wqflask.correlation.pre_computes import fetch_text_file from wqflask.correlation.pre_computes import read_text_file +from wqflask.correlation.pre_computes import write_db_to_textfile from gn3.computations.correlations import compute_all_lit_correlation from gn3.computations.rust_correlation import run_correlation from gn3.computations.rust_correlation import get_sample_corr_data @@ -195,7 +196,7 @@ def compute_top_n_tissue(this_dataset, this_trait, traits, method): symbol_dict=get_trait_symbol_and_tissue_values( symbol_list=[this_trait.symbol]), dataset_symbols=trait_symbol_dict, - dataset_vals=corr_result_tissue_vals_dict) + dataset_vals=corr_result_tissue_vals_dict) if data and data[0]: return run_correlation( @@ -237,7 +238,15 @@ def __compute_sample_corr__( if file_path: (sample_vals, target_data) = read_text_file( sample_data, file_path) - return run_correlation(target_data, sample_vals, method, ",", corr_type, n_top) + return run_correlation(target_data, sample_vals, + method, ",", corr_type, n_top) + write_db_to_textfile(target_dataset.name, conn) + file_path = fetch_text_file(target_dataset.name, conn) + if file_path: + (sample_vals, target_data) = read_text_file( + sample_data, file_path) + return run_correlation(target_data, sample_vals, + method, ",", corr_type, n_top) target_dataset.get_trait_data(list(sample_data.keys())) @@ -248,7 +257,7 @@ def __compute_sample_corr__( target_data.append(r) if len(target_data) == 0: - return {} + return {} return run_correlation( target_data, list(sample_data.values()), method, ",", corr_type, |