aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorAlexander Kabui2021-05-15 00:57:19 +0300
committerBonfaceKilz2021-05-17 10:02:01 +0300
commit2ddc4c1d3216e400a4bed191b1a2a469512c2535 (patch)
tree8849440992f30e5067b675ff8b4b5855643af509 /wqflask
parentd24b1d542f0fc84a3a2c214516459d0a3a9f97a4 (diff)
downloadgenenetwork2-2ddc4c1d3216e400a4bed191b1a2a469512c2535.tar.gz
handle None for tissue input data
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/correlation/correlation_gn3_api.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/wqflask/wqflask/correlation/correlation_gn3_api.py b/wqflask/wqflask/correlation/correlation_gn3_api.py
index 46202ca3..6974dbd5 100644
--- a/wqflask/wqflask/correlation/correlation_gn3_api.py
+++ b/wqflask/wqflask/correlation/correlation_gn3_api.py
@@ -80,13 +80,16 @@ def tissue_for_trait_lists(corr_results, this_dataset, this_trait):
traits_symbol_dict = this_dataset.retrieve_genes("Symbol")
traits_symbol_dict = dict({trait_name: symbol for (
trait_name, symbol) in traits_symbol_dict.items() if trait_lists.get(trait_name)})
- primary_tissue_data, target_tissue_data = get_tissue_correlation_input(
+ tissue_input = get_tissue_correlation_input(
this_trait, traits_symbol_dict)
- corr_results = compute_tissue_correlation(
- primary_tissue_dict=primary_tissue_data,
- target_tissues_data=target_tissue_data,
- corr_method="pearson")
- return corr_results
+
+ if tissue_input is not None:
+ (primary_tissue_data, target_tissue_data) = tissue_input
+ corr_results = compute_tissue_correlation(
+ primary_tissue_dict=primary_tissue_data,
+ target_tissues_data=target_tissue_data,
+ corr_method="pearson")
+ return corr_results
def lit_for_trait_list(corr_results, this_dataset, this_trait):
@@ -153,9 +156,12 @@ def compute_correlation(start_vars, method="pearson"):
elif corr_type == "tissue":
trait_symbol_dict = this_dataset.retrieve_genes("Symbol")
- primary_tissue_data, target_tissue_data = get_tissue_correlation_input(
+ tissue_input = get_tissue_correlation_input(
this_trait, trait_symbol_dict)
+ if tissue_input is not None:
+ (primary_tissue_data, target_tissue_data) = tissue_input
+
corr_input_data = {
"primary_tissue": primary_tissue_data,
"target_tissues_dict": target_tissue_data
@@ -208,15 +214,18 @@ def compute_corr_for_top_results(correlation_results,
tissue_result = tissue_for_trait_lists(
correlation_results, this_dataset, this_trait)
- correlation_results = merge_correlation_results(
- correlation_results, tissue_result)
+ if tissue_result:
+
+ correlation_results = merge_correlation_results(
+ correlation_results, tissue_result)
if corr_type != "lit" and this_dataset.type == "ProbeSet" and target_dataset.type == "ProbeSet":
lit_result = lit_for_trait_list(
correlation_results, this_dataset, this_trait)
- correlation_results = merge_correlation_results(
- correlation_results, lit_result)
+ if lit_result:
+ correlation_results = merge_correlation_results(
+ correlation_results, lit_result)
if corr_type != "sample":
pass