aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-03-05 12:54:05 +0300
committerBonfaceKilz2021-03-08 21:09:58 +0300
commita896c25bbe4f640665d547307efe389817f17848 (patch)
treeae5595254e923cac8d3faaa3da8903ff11365933
parent8752937bc1e3cea84eefd3e363b429157f25acb5 (diff)
downloadgenenetwork3-a896c25bbe4f640665d547307efe389817f17848.tar.gz
Use new "compute_k_values" procedure
-rw-r--r--gn3/api/gemma.py43
1 files changed, 17 insertions, 26 deletions
diff --git a/gn3/api/gemma.py b/gn3/api/gemma.py
index d08c11b..1751530 100644
--- a/gn3/api/gemma.py
+++ b/gn3/api/gemma.py
@@ -116,24 +116,19 @@ traitfile, and snpsfile are extracted from a metadata.json file.
if not do_paths_exist([genofile, phenofile, snpsfile]):
raise FileNotFoundError
gemma_kwargs = {"g": genofile, "p": phenofile, "a": snpsfile}
- _hash = get_hash_of_files([genofile, phenofile, snpsfile])
- k_output_filename = f"{_hash}-k-output.json"
+ results = compute_k_values(gemma_cmd=current_app.config.get(
+ "GEMMA_"
+ "WRAPPER_CMD"),
+ 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=compose_gemma_cmd(gemma_wrapper_cmd=current_app.config.get(
- "GEMMA_"
- "WRAPPER_CMD"),
- gemma_wrapper_kwargs=None,
- gemma_kwargs=gemma_kwargs,
- gemma_args=[
- "-gk", ">",
- (f"{current_app.config.get('TMPDIR')}/"
- f"{token}/{k_output_filename}")
- ])),
+ cmd=results.get("gemma_cmd")),
status="queued",
- output_file=k_output_filename)
+ output_file=results.get("output_file"))
# pylint: disable=W0703
except Exception:
return jsonify(
@@ -158,24 +153,20 @@ values.
if not do_paths_exist([genofile, phenofile, snpsfile]):
raise FileNotFoundError
gemma_kwargs = {"g": genofile, "p": phenofile, "a": snpsfile}
- _hash = get_hash_of_files([genofile, phenofile, snpsfile])
- k_output_filename = f"{_hash}-k-output.json"
+ results = compute_k_values(gemma_cmd=current_app.config.get(
+ "GEMMA_"
+ "WRAPPER_CMD"),
+ output_dir=current_app.config.get('TMPDIR'),
+ 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=compose_gemma_cmd(
- gemma_wrapper_cmd=current_app.config.get("GEMMA_"
- "WRAPPER_CMD"),
- gemma_wrapper_kwargs={"loco": f"--input {chromosomes}"},
- gemma_kwargs=gemma_kwargs,
- gemma_args=[
- "-gk", ">",
- (f"{current_app.config.get('TMPDIR')}/"
- f"{token}/{k_output_filename}")
- ])),
+ cmd=results.get("gemma_cmd")),
status="queued",
- output_file=k_output_filename)
+ output_file=results.get("output_file"))
# pylint: disable=W0703
except Exception:
return jsonify(