aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-05-16 12:49:12 +0300
committerFrederick Muriuki Muriithi2022-05-16 12:51:46 +0300
commit3e6baf7ad38770950d13f3a0929337a318fb0414 (patch)
treed8bc9a98f5b3f26f2d217ff07e6853334e08d42b /wqflask
parent4f399a72197aad9821503aa6f916c396cb596a91 (diff)
downloadgenenetwork2-3e6baf7ad38770950d13f3a0929337a318fb0414.tar.gz
Fix errors: with_target_db and target_traits issues
- Ensure the 'with_target_db' value is set up correctly when sending request to GN3 API - Set up empty target traits list in case none has been provided
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/partial_correlations_views.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/wqflask/wqflask/partial_correlations_views.py b/wqflask/wqflask/partial_correlations_views.py
index 40c5132b..0d086567 100644
--- a/wqflask/wqflask/partial_correlations_views.py
+++ b/wqflask/wqflask/partial_correlations_views.py
@@ -164,13 +164,16 @@ def criteria_error(args):
("Invalid return number provided",))}
def errors(args, with_target_db: bool):
- return criteria_error(
- method_error(
- target_traits_error(
- target_db_error(
- controls_error(primary_error(args)),
- with_target_db),
- not with_target_db)))
+ return {
+ **criteria_error(
+ method_error(
+ target_traits_error(
+ target_db_error(
+ controls_error(primary_error(args)),
+ with_target_db),
+ not with_target_db))),
+ "with_target_db": with_target_db
+ }
def __classify_args(acc, item):
if item[1].startswith("primary_"):
@@ -201,7 +204,7 @@ def __build_args(raw_form, traits):
(name[1][9:] for name in args["control_traits"])],
"target_traits": [
item for item in traits if item["trait_name"] in
- (name[1][8:] for name in args["target_traits"])]
+ (name[1][8:] for name in args.get("target_traits", tuple()))]
}
def parse_trait(trait_str):
@@ -279,7 +282,7 @@ def partial_correlations():
post_data = {
**args,
"primary_trait": args["primary_trait"][0],
- "with_target_db": False
+ "with_target_db": args["with_target_db"]
}
return handle_response(requests.post(
url=f"{GN_SERVER_URL}api/correlation/partial",
@@ -294,7 +297,7 @@ def partial_correlations():
post_data = {
**args,
"primary_trait": args["primary_trait"][0],
- "with_target_db": False
+ "with_target_db": args["with_target_db"]
}
return handle_response(requests.post(
url=f"{GN_SERVER_URL}api/correlation/partial",