aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-10-06 10:43:18 +0300
committerFrederick Muriuki Muriithi2022-10-06 10:43:18 +0300
commit575f08119c7aff56ff86c4fc30ab2eaab061d11d (patch)
treeaafd31e30c41cc39b61e3e2514b110bfd62487c7
parent721223e5879cb44d7186a2f32282371c7fb6090a (diff)
downloadgenenetwork2-575f08119c7aff56ff86c4fc30ab2eaab061d11d.tar.gz
Check for incompatible datasets for various correlation types.
-rw-r--r--wqflask/wqflask/correlation/rust_correlation.py8
1 files changed, 7 insertions, 1 deletions
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 = {