diff options
author | zsloan | 2021-05-18 19:42:27 +0000 |
---|---|---|
committer | zsloan | 2021-05-18 19:42:27 +0000 |
commit | 33d3a518e378c56b080a2a15b264ee5d031537e8 (patch) | |
tree | d7a497f1f19da648c685ac7e3ed1aae75c3f96df /gn3/api | |
parent | e61aa16f0bc3dd282060585e655e497fa3d06b49 (diff) | |
download | genenetwork3-33d3a518e378c56b080a2a15b264ee5d031537e8.tar.gz |
Account for boolean kwargs in compute() by storing them in a list, since they don't have corresponding values
Diffstat (limited to 'gn3/api')
-rw-r--r-- | gn3/api/rqtl.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gn3/api/rqtl.py b/gn3/api/rqtl.py index 7756310..de620f7 100644 --- a/gn3/api/rqtl.py +++ b/gn3/api/rqtl.py @@ -21,16 +21,24 @@ run the rqtl_wrapper script and return the results as JSON if not do_paths_exist([genofile, phenofile]): raise FileNotFoundError - kwarg_list = ["addcovar", "model", "method", "interval", "nperm", "scale", "control_marker"] + # 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"] + all_kwargs = kwargs + boolean_kwargs rqtl_kwargs = {"geno": genofile, "pheno": phenofile} - for kwarg in kwarg_list: + rqtl_bool_kwargs = [] + for kwarg in all_kwargs: if kwarg in request.form: - rqtl_kwargs[kwarg] = request.form[kwarg] + if kwarg in kwargs: + rqtl_kwargs[kwarg] = request.form[kwarg] + if kwarg in boolean_kwargs: + rqtl_bool_kwargs.append(kwarg) results = generate_rqtl_cmd( rqtl_wrapper_cmd=current_app.config.get("RQTL_WRAPPER_CMD"), - rqtl_wrapper_kwargs=rqtl_kwargs + rqtl_wrapper_kwargs=rqtl_kwargs, + rqtl_wrapper_bool_kwargs=boolean_kwargs ) return jsonify(results) |