diff options
-rw-r--r-- | wqflask/wqflask/correlation/rust_correlation.py | 13 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/show_trait.js | 14 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait_calculate_correlations.html | 8 |
3 files changed, 32 insertions, 3 deletions
diff --git a/wqflask/wqflask/correlation/rust_correlation.py b/wqflask/wqflask/correlation/rust_correlation.py index 5ae5e89c..188278d8 100644 --- a/wqflask/wqflask/correlation/rust_correlation.py +++ b/wqflask/wqflask/correlation/rust_correlation.py @@ -247,22 +247,31 @@ def __compute_sample_corr__( if not bool(sample_data): return {} - if target_dataset.type == "ProbeSet": + + if target_dataset.type == "ProbeSet" and start_vars.get("use_cache") == "true": with database_connector() as 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) + + 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())) def __merge_key_and_values__(rows, current): @@ -277,6 +286,7 @@ def __compute_sample_corr__( if len(target_data) == 0: return {} + return run_correlation( target_data, list(sample_data.values()), method, ",", corr_type, n_top) @@ -352,6 +362,7 @@ def compute_correlation_rust( "tissue": __compute_tissue_corr__, "lit": __compute_lit_corr__ } + results = corr_type_fns[corr_type]( start_vars, corr_type, method, n_top, target_trait_info) diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 1f76dbdf..6d412ab0 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -567,27 +567,37 @@ $('select[name=location_type]').change(on_dataset_change); submit_special = function(url) { $("input[name=sample_vals]").val(JSON.stringify(fetchSampleValues())) $("#trait_data_form").attr("action", url); + $("#trait_data_form").submit(); }; var corrInputList = ['sample_vals', 'corr_type', 'primary_samples', 'trait_id', 'dataset', 'group', 'tool_used', 'form_url', 'corr_sample_method', 'corr_samples_group', 'corr_dataset', 'min_expr', - 'corr_return_results', 'location_type', 'loc_chr', 'min_loc_mb', 'max_loc_mb', 'p_range_lower', 'p_range_upper'] + 'corr_return_results', 'location_type', 'loc_chr', 'min_loc_mb', 'max_loc_mb', 'p_range_lower', 'p_range_upper',"use_cache"] $(".test_corr_compute").on("click", (function(_this) { return function() { $('input[name=tool_used]').val("Correlation"); $('input[name=form_url]').val("/test_corr_compute"); $('input[name=wanted_inputs]').val(corrInputList.join(",")); + + url = "/loading"; return submit_special(url); }; })(this)); $(".corr_compute").on("click", (function(_this) { - return function() { + + return function() { + + $('input[name=tool_used]').val("Correlation"); $('input[name=form_url]').val("/corr_compute"); $('input[name=wanted_inputs]').val(corrInputList.join(",")); + + + $('input[name=use_cache]').val($('#use_cache').is(":checked") ? "true": "false"); + url = "/loading"; return submit_special(url); }; diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html index 28f2141c..33100484 100644 --- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html +++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html @@ -113,6 +113,14 @@ </div> </div> + + <div class="form-group"> + <label class="col-xs-2 control-label" >use cache</label> + <div class="col-xs-5 controls"> + <input id="use_cache" name="use_cache" type="checkbox" checked> + </div> + </div> + <div class="form-group"> <label for="corr_sample_method" class="col-xs-2 control-label"></label> <div class="col-xs-3 controls"> |