aboutsummaryrefslogtreecommitdiff
path: root/gn3/api
diff options
context:
space:
mode:
authorzsloan2021-05-28 17:44:07 +0000
committerzsloan2021-06-18 22:08:04 +0000
commit84790de8bcc51c00a92b71878088345cd58ccc51 (patch)
treeb5e8abb89b9b76565abcdda895629744fc53e7f6 /gn3/api
parent9b8fb0f63114119e58663a3e7fee352ce7375fb4 (diff)
downloadgenenetwork3-84790de8bcc51c00a92b71878088345cd58ccc51.tar.gz
Fixed issue where all bool kwargs were always being passed to generate_rqtl_cmd and also made code check if output file already exists (so caching works)
Diffstat (limited to 'gn3/api')
-rw-r--r--gn3/api/rqtl.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/gn3/api/rqtl.py b/gn3/api/rqtl.py
index 0194b6f..38f4c1e 100644
--- a/gn3/api/rqtl.py
+++ b/gn3/api/rqtl.py
@@ -26,7 +26,7 @@ run the rqtl_wrapper script and return the results as JSON
# Split kwargs by those with values and boolean ones that just convert to True/False
kwargs = ["model", "method", "nperm", "scale", "control_marker"]
- boolean_kwargs = ["addcovar", "interval"]
+ boolean_kwargs = ["addcovar", "interval", "pstrata"]
all_kwargs = kwargs + boolean_kwargs
rqtl_kwargs = {"geno": genofile, "pheno": phenofile}
@@ -41,12 +41,15 @@ run the rqtl_wrapper script and return the results as JSON
rqtl_cmd = generate_rqtl_cmd(
rqtl_wrapper_cmd=current_app.config.get("RQTL_WRAPPER_CMD"),
rqtl_wrapper_kwargs=rqtl_kwargs,
- rqtl_wrapper_bool_kwargs=boolean_kwargs
+ rqtl_wrapper_bool_kwargs=rqtl_bool_kwargs
)
- os.system(rqtl_cmd.get('rqtl_cmd'))
-
rqtl_output = {}
+ if not os.path.isfile(os.path.join(current_app.config.get("TMPDIR"), "output", rqtl_cmd.get('output_file'))):
+ os.system(rqtl_cmd.get('rqtl_cmd'))
+
+ rqtl_output['results'] = process_rqtl_output(rqtl_cmd.get('output_file'))
+
rqtl_output['results'] = process_rqtl_output(rqtl_cmd.get('output_file'))
if int(rqtl_kwargs['nperm']) > 0:
rqtl_output['perm_results'], rqtl_output['suggestive'], rqtl_output['significant'] = process_perm_output(rqtl_cmd.get('output_file'))