diff options
author | Frederick Muriuki Muriithi | 2022-05-06 16:43:26 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-05-06 16:43:26 +0300 |
commit | 4a9fd93d01b6d4bd9d9880dbf2274b3c7f2de37b (patch) | |
tree | 088287b7e1e65399529a405377968905c5017c01 /gn3/api | |
parent | d04241d0e49a50d9aa775042fffe5a7d8cfaf551 (diff) | |
download | genenetwork3-4a9fd93d01b6d4bd9d9880dbf2274b3c7f2de37b.tar.gz |
Fix linting and typing errors
Diffstat (limited to 'gn3/api')
-rw-r--r-- | gn3/api/correlation.py | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/gn3/api/correlation.py b/gn3/api/correlation.py index aeb7f8c..44aaf56 100644 --- a/gn3/api/correlation.py +++ b/gn3/api/correlation.py @@ -114,13 +114,10 @@ def partial_correlation(): args = request.get_json() with_target_db = args.get("with_target_db", True) - request_errors = None - if with_target_db: - request_errors = __errors__( - args, ("primary_trait", "control_traits", "target_db", "method")) - else: - request_errors = __errors__( - args, ("primary_trait", "control_traits", "target_traits", "method")) + request_errors = __errors__( + args, ("primary_trait", "control_traits", + ("target_db" if with_target_db else "target_traits"), + "method")) if request_errors: return build_response({ "status": "error", @@ -140,15 +137,15 @@ def partial_correlation(): int(args.get("criteria", 500))), job_queue=current_app.config.get("REDIS_JOB_QUEUE"), env = {"PYTHONPATH": ":".join(sys.path), "SQL_URI": SQL_URI})}) - else: - with database_connector() as conn: - results = partial_correlations_with_target_traits( - conn, - trait_fullname(args["primary_trait"]), - tuple( - trait_fullname(trait) for trait in args["control_traits"]), - tuple( - trait_fullname(trait) for trait in args["target_traits"]), - args["method"]) - - return build_response({"status": "success", "results": results}) + + with database_connector() as conn: + results = partial_correlations_with_target_traits( + conn, + trait_fullname(args["primary_trait"]), + tuple( + trait_fullname(trait) for trait in args["control_traits"]), + tuple( + trait_fullname(trait) for trait in args["target_traits"]), + args["method"]) + + return build_response({"status": "success", "results": results}) |