From 575f08119c7aff56ff86c4fc30ab2eaab061d11d Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 6 Oct 2022 10:43:18 +0300 Subject: Check for incompatible datasets for various correlation types. --- wqflask/wqflask/correlation/rust_correlation.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/correlation/rust_correlation.py b/wqflask/wqflask/correlation/rust_correlation.py index 5c4d0b8a..aee08cba 100644 --- a/wqflask/wqflask/correlation/rust_correlation.py +++ b/wqflask/wqflask/correlation/rust_correlation.py @@ -160,6 +160,9 @@ def compute_top_n_sample(start_vars, dataset, trait_list): def compute_top_n_lit(corr_results, target_dataset, this_trait) -> dict: + if not __datasets_compatible_p__(this_trait.dataset, target_dataset, "lit"): + return {} + (this_trait_geneid, geneid_dict, species) = do_lit_correlation( this_trait, target_dataset) @@ -178,8 +181,9 @@ def compute_top_n_lit(corr_results, target_dataset, this_trait) -> dict: def compute_top_n_tissue(target_dataset, this_trait, traits, method): - # refactor lots of rpt + if not __datasets_compatible_p__(this_trait.dataset, target_dataset, "tissue"): + return {} trait_symbol_dict = dict({ trait_name: symbol @@ -326,6 +330,8 @@ def compute_correlation_rust( target_trait_info = create_target_this_trait(start_vars) (this_dataset, this_trait, target_dataset, sample_data) = ( target_trait_info) + if not __datasets_compatible_p__(this_dataset, target_dataset, corr_type): + raise WrongCorrelationType(this_trait, target_dataset, corr_type) # Replace this with `match ...` once we hit Python 3.10 corr_type_fns = { -- cgit v1.2.3