diff options
author | zsloan | 2019-11-26 13:51:30 -0600 |
---|---|---|
committer | zsloan | 2019-11-26 13:51:30 -0600 |
commit | 022180f032c7ff790dc0badf9458b959ac48ee8c (patch) | |
tree | faaa6358da02d4a5d21c9a08b5064aae26c0e960 | |
parent | 0ec99ac9e0315d4fda8decc0f509c08370119a70 (diff) | |
download | genenetwork2-022180f032c7ff790dc0badf9458b959ac48ee8c.tar.gz |
Changed rqtl2 genotype download to export all datasets, not just phenotype ones + let user type in .zip extension
-rw-r--r-- | wqflask/wqflask/api/router.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/wqflask/wqflask/api/router.py b/wqflask/wqflask/api/router.py index 4cd10b37..e371a24e 100644 --- a/wqflask/wqflask/api/router.py +++ b/wqflask/wqflask/api/router.py @@ -719,10 +719,12 @@ def get_mapping_results(): else: return return_error(code=204, source=request.url_rule.rule, title="No Results", details="") -@app.route("/api/v_{}/genotypes/<path:group_name>.<path:file_format>".format(version)) -@app.route("/api/v_{}/genotypes/<path:file_format>/<path:group_name>".format(version)) -@app.route("/api/v_{}/genotypes/<path:group_name>.<path:file_format>".format(version)) -def get_genotypes(group_name, file_format="csv"): +@app.route("/api/v_{}/genotypes/<string:file_format>/<string:group_name>/<string:dataset_name>.zip".format(version)) +@app.route("/api/v_{}/genotypes/<string:file_format>/<string:group_name>/<string:dataset_name>".format(version)) +@app.route("/api/v_{}/genotypes/<string:file_format>/<string:group_name>.zip".format(version)) +@app.route("/api/v_{}/genotypes/<string:file_format>/<string:group_name>".format(version)) +@app.route("/api/v_{}/genotypes/<string:group_name>.<string:file_format>".format(version)) +def get_genotypes(group_name, file_format="csv", dataset_name=None): limit_num = None if 'limit_to' in request.args: if request.args['limit_to'].isdigit(): @@ -756,7 +758,10 @@ def get_genotypes(group_name, file_format="csv"): config_file = open("{0}/{1}.yaml".format(flat_files("genotype/rqtl2"), group_name)) geno_file = open("{0}/{1}_geno.csv".format(flat_files("genotype/rqtl2"), group_name)) gmap_file = open("{0}/{1}_gmap.csv".format(flat_files("genotype/rqtl2"), group_name)) - phenotypes = requests.get("http://gn2.genenetwork.org/api/v_pre1/sample_data/" + group_name + "Publish") + if dataset_name: + phenotypes = requests.get("http://gn2.genenetwork.org/api/v_pre1/sample_data/" + dataset_name) + else: + phenotypes = requests.get("http://gn2.genenetwork.org/api/v_pre1/sample_data/" + group_name + "Publish") with ZipFile(memory_file, 'w', compression=ZIP_DEFLATED) as zf: for this_file in [config_file, geno_file, gmap_file]: |