diff options
author | zsloan | 2021-05-25 20:27:05 +0000 |
---|---|---|
committer | zsloan | 2021-05-25 20:27:05 +0000 |
commit | d3a4146fd38fc1d372091cecadfcf7c8fb377f3b (patch) | |
tree | f89a04f0aac8d423495cf4340e46e983a1c2fd05 /gn3/api | |
parent | 578a5770c4280c50dc43753429310a43cb6d7e68 (diff) | |
download | genenetwork3-d3a4146fd38fc1d372091cecadfcf7c8fb377f3b.tar.gz |
Include code that processes rqtl output files and returns actual results instead of just the output filename
Diffstat (limited to 'gn3/api')
-rw-r--r-- | gn3/api/rqtl.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gn3/api/rqtl.py b/gn3/api/rqtl.py index de620f7..0194b6f 100644 --- a/gn3/api/rqtl.py +++ b/gn3/api/rqtl.py @@ -1,10 +1,13 @@ """Endpoints for running the rqtl cmd""" +import os + from flask import Blueprint from flask import current_app from flask import jsonify from flask import request -from gn3.computations.rqtl import generate_rqtl_cmd +from gn3.commands import run_cmd +from gn3.computations.rqtl import generate_rqtl_cmd, process_rqtl_output, process_perm_output from gn3.computations.gemma import do_paths_exist rqtl = Blueprint("rqtl", __name__) @@ -35,10 +38,17 @@ run the rqtl_wrapper script and return the results as JSON if kwarg in boolean_kwargs: rqtl_bool_kwargs.append(kwarg) - results = generate_rqtl_cmd( + 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 ) - return jsonify(results) + os.system(rqtl_cmd.get('rqtl_cmd')) + + rqtl_output = {} + 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')) + + return jsonify(rqtl_output) |