From 022180f032c7ff790dc0badf9458b959ac48ee8c Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 26 Nov 2019 13:51:30 -0600 Subject: Changed rqtl2 genotype download to export all datasets, not just phenotype ones + let user type in .zip extension --- wqflask/wqflask/api/router.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'wqflask') 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/.".format(version)) -@app.route("/api/v_{}/genotypes//".format(version)) -@app.route("/api/v_{}/genotypes/.".format(version)) -def get_genotypes(group_name, file_format="csv"): +@app.route("/api/v_{}/genotypes///.zip".format(version)) +@app.route("/api/v_{}/genotypes///".format(version)) +@app.route("/api/v_{}/genotypes//.zip".format(version)) +@app.route("/api/v_{}/genotypes//".format(version)) +@app.route("/api/v_{}/genotypes/.".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]: -- cgit v1.2.3