From e757b65c33908c83f8bc1706b0f28298885bd597 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Mon, 22 Mar 2021 13:32:44 +0300 Subject: Apply auto-pep8 formatting --- gn3/api/gemma.py | 158 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 84 insertions(+), 74 deletions(-) (limited to 'gn3') diff --git a/gn3/api/gemma.py b/gn3/api/gemma.py index 2bdaf26..0f4b8e3 100644 --- a/gn3/api/gemma.py +++ b/gn3/api/gemma.py @@ -60,13 +60,14 @@ traitfile, and snpsfile are extracted from a metadata.json file. output_dir=current_app.config.get('TMPDIR'), token=token, gemma_kwargs=gemma_kwargs) - return jsonify(unique_id=queue_cmd( - conn=redis.Redis(), - email=(request.get_json() or {}).get('email'), - job_queue=current_app.config.get("REDIS_JOB_QUEUE"), - cmd=results.get("gemma_cmd")), - status="queued", - output_file=results.get("output_file")) + return jsonify( + unique_id=queue_cmd( + conn=redis.Redis(), + email=(request.get_json() or {}).get('email'), + job_queue=current_app.config.get("REDIS_JOB_QUEUE"), + cmd=results.get("gemma_cmd")), + status="queued", + output_file=results.get("output_file")) # pylint: disable=W0703 except Exception: return jsonify( @@ -98,13 +99,14 @@ values. token=token, gemma_kwargs=gemma_kwargs, chromosomes=chromosomes) - return jsonify(unique_id=queue_cmd( - conn=redis.Redis(), - email=(request.get_json() or {}).get('email'), - job_queue=current_app.config.get("REDIS_JOB_QUEUE"), - cmd=results.get("gemma_cmd")), - status="queued", - output_file=results.get("output_file")) + return jsonify( + unique_id=queue_cmd( + conn=redis.Redis(), + email=(request.get_json() or {}).get('email'), + job_queue=current_app.config.get("REDIS_JOB_QUEUE"), + cmd=results.get("gemma_cmd")), + status="queued", + output_file=results.get("output_file")) # pylint: disable=W0703 except Exception: return jsonify( @@ -140,13 +142,14 @@ def compute_gwa(k_filename, token): gemma_wrapper_kwargs={ "input": os.path.join(working_dir, k_filename) }) - return jsonify(unique_id=queue_cmd( - conn=redis.Redis(), - email=(request.get_json() or {}).get('email'), - job_queue=current_app.config.get("REDIS_JOB_QUEUE"), - cmd=results.get("gemma_cmd")), - status="queued", - output_file=results.get("output_file")) + return jsonify( + unique_id=queue_cmd( + conn=redis.Redis(), + email=(request.get_json() or {}).get('email'), + job_queue=current_app.config.get("REDIS_JOB_QUEUE"), + cmd=results.get("gemma_cmd")), + status="queued", + output_file=results.get("output_file")) # pylint: disable=W0703 except Exception: return jsonify( @@ -183,13 +186,14 @@ def compute_gwa_with_covar(k_filename, token): gemma_wrapper_kwargs={ "input": os.path.join(working_dir, k_filename) }) - return jsonify(unique_id=queue_cmd( - conn=redis.Redis(), - email=(request.get_json() or {}).get('email'), - job_queue=current_app.config.get("REDIS_JOB_QUEUE"), - cmd=results.get("gemma_cmd")), - status="queued", - output_file=results.get("output_file")) + return jsonify( + unique_id=queue_cmd( + conn=redis.Redis(), + email=(request.get_json() or {}).get('email'), + job_queue=current_app.config.get("REDIS_JOB_QUEUE"), + cmd=results.get("gemma_cmd")), + status="queued", + output_file=results.get("output_file")) # pylint: disable=W0703 except Exception: return jsonify( @@ -229,13 +233,14 @@ def compute_gwa_with_loco_maf(k_filename, maf, token): gemma_wrapper_kwargs={ "loco": f"--input {os.path.join(working_dir, k_filename)}" }) - return jsonify(unique_id=queue_cmd( - conn=redis.Redis(), - email=(request.get_json() or {}).get('email'), - job_queue=current_app.config.get("REDIS_JOB_QUEUE"), - cmd=results.get("gemma_cmd")), - status="queued", - output_file=results.get("output_file")) + return jsonify( + unique_id=queue_cmd( + conn=redis.Redis(), + email=(request.get_json() or {}).get('email'), + job_queue=current_app.config.get("REDIS_JOB_QUEUE"), + cmd=results.get("gemma_cmd")), + status="queued", + output_file=results.get("output_file")) # pylint: disable=W0703 except Exception: return jsonify( @@ -276,13 +281,14 @@ def compute_gwa_with_loco_covar(k_filename, maf, token): gemma_wrapper_kwargs={ "loco": f"--input {os.path.join(working_dir, k_filename)}" }) - return jsonify(unique_id=queue_cmd( - conn=redis.Redis(), - email=(request.get_json() or {}).get('email'), - job_queue=current_app.config.get("REDIS_JOB_QUEUE"), - cmd=results.get("gemma_cmd")), - status="queued", - output_file=results.get("output_file")) + return jsonify( + unique_id=queue_cmd( + conn=redis.Redis(), + email=(request.get_json() or {}).get('email'), + job_queue=current_app.config.get("REDIS_JOB_QUEUE"), + cmd=results.get("gemma_cmd")), + status="queued", + output_file=results.get("output_file")) # pylint: disable=W0703 except Exception: return jsonify( @@ -326,14 +332,15 @@ covars; lmm defaults to 9! "input": os.path.join(working_dir, gemma_k_cmd.get("output_file")) }) - return jsonify(unique_id=queue_cmd( - conn=redis.Redis(), - email=(request.get_json() or {}).get('email'), - job_queue=current_app.config.get("REDIS_JOB_QUEUE"), - cmd=(f"{gemma_k_cmd.get('gemma_cmd')} && " - f"{gemma_gwa_cmd.get('gemma_cmd')}")), - status="queued", - output_file=gemma_gwa_cmd.get("output_file")) + return jsonify( + unique_id=queue_cmd( + conn=redis.Redis(), + email=(request.get_json() or {}).get('email'), + job_queue=current_app.config.get("REDIS_JOB_QUEUE"), + cmd=(f"{gemma_k_cmd.get('gemma_cmd')} && " + f"{gemma_gwa_cmd.get('gemma_cmd')}")), + status="queued", + output_file=gemma_gwa_cmd.get("output_file")) # pylint: disable=W0703 except Exception: return jsonify( @@ -378,14 +385,15 @@ covars; lmm defaults to 9! "input": os.path.join(working_dir, gemma_k_cmd.get("output_file")) }) - return jsonify(unique_id=queue_cmd( - conn=redis.Redis(), - email=(request.get_json() or {}).get('email'), - job_queue=current_app.config.get("REDIS_JOB_QUEUE"), - cmd=(f"{gemma_k_cmd.get('gemma_cmd')} && " - f"{gemma_gwa_cmd.get('gemma_cmd')}")), - status="queued", - output_file=gemma_gwa_cmd.get("output_file")) + return jsonify( + unique_id=queue_cmd( + conn=redis.Redis(), + email=(request.get_json() or {}).get('email'), + job_queue=current_app.config.get("REDIS_JOB_QUEUE"), + cmd=(f"{gemma_k_cmd.get('gemma_cmd')} && " + f"{gemma_gwa_cmd.get('gemma_cmd')}")), + status="queued", + output_file=gemma_gwa_cmd.get("output_file")) # pylint: disable=W0703 except Exception: return jsonify( @@ -431,14 +439,15 @@ def compute_k_gwa_with_loco_only(chromosomes, maf, token): f"{os.path.join(working_dir, gemma_k_cmd.get('output_file'))}" ) }) - return jsonify(unique_id=queue_cmd( - conn=redis.Redis(), - email=(request.get_json() or {}).get('email'), - job_queue=current_app.config.get("REDIS_JOB_QUEUE"), - cmd=(f"{gemma_k_cmd.get('gemma_cmd')} && " - f"{gemma_gwa_cmd.get('gemma_cmd')}")), - status="queued", - output_file=gemma_gwa_cmd.get("output_file")) + return jsonify( + unique_id=queue_cmd( + conn=redis.Redis(), + email=(request.get_json() or {}).get('email'), + job_queue=current_app.config.get("REDIS_JOB_QUEUE"), + cmd=(f"{gemma_k_cmd.get('gemma_cmd')} && " + f"{gemma_gwa_cmd.get('gemma_cmd')}")), + status="queued", + output_file=gemma_gwa_cmd.get("output_file")) # pylint: disable=W0703 except Exception: return jsonify( @@ -485,14 +494,15 @@ def compute_k_gwa_with_loco_and_cavar(chromosomes, maf, token): f"{os.path.join(working_dir, gemma_k_cmd.get('output_file'))}" ) }) - return jsonify(unique_id=queue_cmd( - conn=redis.Redis(), - email=(request.get_json() or {}).get('email'), - job_queue=current_app.config.get("REDIS_JOB_QUEUE"), - cmd=(f"{gemma_k_cmd.get('gemma_cmd')} && " - f"{gemma_gwa_cmd.get('gemma_cmd')}")), - status="queued", - output_file=gemma_gwa_cmd.get("output_file")) + return jsonify( + unique_id=queue_cmd( + conn=redis.Redis(), + email=(request.get_json() or {}).get('email'), + job_queue=current_app.config.get("REDIS_JOB_QUEUE"), + cmd=(f"{gemma_k_cmd.get('gemma_cmd')} && " + f"{gemma_gwa_cmd.get('gemma_cmd')}")), + status="queued", + output_file=gemma_gwa_cmd.get("output_file")) # pylint: disable=W0703 except Exception: return jsonify( -- cgit v1.2.3