aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2022-11-23 23:28:22 +0000
committerzsloan2022-11-23 23:29:55 +0000
commitd318b1d649a3ece1a5a6c24bcd3496e14dbc69cd (patch)
tree84696bbaf199d139a7acd254677fab7a63b27ccd /wqflask
parent0886baf8971c48a13c78c3c6397f486898ff4700 (diff)
downloadgenenetwork2-d318b1d649a3ece1a5a6c24bcd3496e14dbc69cd.tar.gz
Make some changes to prevent show_corr_results.py bugs (details below)
At one point the MonadicDict of the dataset ob was being passed to create_trait, which does not work. I changed it back to passing the object Another place calls "as_dict" on the dataset ob, which doesn't work; I had to call as_monadic_dict().data for that Some traits are also None for some reason, which caused an error in the filter. For now I just used an if/else, but someone can deal with this differently later
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/correlation/show_corr_results.py49
1 files changed, 25 insertions, 24 deletions
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index 56378d27..0913966c 100644
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -26,7 +26,6 @@ from base.data_set import create_dataset
from utility import hmac
from utility.type_checking import get_float, get_int, get_string
-
def set_template_vars(start_vars, correlation_data):
corr_type = start_vars['corr_type']
corr_method = start_vars['corr_sample_method']
@@ -47,7 +46,7 @@ def set_template_vars(start_vars, correlation_data):
correlation_data['table_json'] = correlation_json_for_table(
start_vars,
correlation_data,
- target_dataset_ob.as_monadic_dict().data)
+ target_dataset_ob)
if target_dataset_ob.type == "ProbeSet":
filter_cols = [7, 6]
@@ -110,28 +109,30 @@ def apply_filters(trait, target_trait, target_dataset, **filters):
return True
- # check if one of the condition is not met i.e One is True
-
- return (__p_val_filter__(
- filters.get("p_range_lower"),
- filters.get("p_range_upper")
- )
- or
- (
- __min_filter__(
- filters.get("min_expr")
- )
- )
- or
- __location_filter__(
- filters.get("location_type"),
- filters.get("location_chr"),
- filters.get("min_location_mb"),
- filters.get("max_location_mb")
+ if not target_trait:
+ return True
+ else:
+ # check if one of the condition is not met i.e One is True
+ return (__p_val_filter__(
+ filters.get("p_range_lower"),
+ filters.get("p_range_upper")
+ )
+ or
+ (
+ __min_filter__(
+ filters.get("min_expr")
+ )
+ )
+ or
+ __location_filter__(
+ filters.get("location_type"),
+ filters.get("location_chr"),
+ filters.get("min_location_mb"),
+ filters.get("max_location_mb")
- )
- )
+ )
+ )
def get_user_filters(start_vars):
@@ -280,7 +281,7 @@ def correlation_json_for_table(start_vars, correlation_data, target_dataset_ob):
target_dataset_ob)
return json.dumps([result for result in (
populate_table(dataset_metadata=dataset_metadata,
- target_dataset=target_dataset_ob.as_dict(),
+ target_dataset=target_dataset_ob.as_monadic_dict().data,
this_dataset=correlation_data['this_dataset'],
corr_results=correlation_data['correlation_results'],
filters=get_user_filters(start_vars))) if result])
@@ -385,4 +386,4 @@ def get_header_fields(data_type, corr_method):
'N',
'Sample p(r)']
- return header_fields \ No newline at end of file
+ return header_fields