aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2019-11-25 13:00:09 -0600
committerzsloan2019-11-25 13:00:09 -0600
commit0ec99ac9e0315d4fda8decc0f509c08370119a70 (patch)
tree937d09780a8ba94610d03d68275b440e8568142d /wqflask
parent2f4cda9f115dd9ddd1e2dce556cee11e66658ff4 (diff)
downloadgenenetwork2-0ec99ac9e0315d4fda8decc0f509c08370119a70.tar.gz
Fixed zipping to actually compress files - it wasn't before
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/api/router.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/wqflask/wqflask/api/router.py b/wqflask/wqflask/api/router.py
index 3708401b..4cd10b37 100644
--- a/wqflask/wqflask/api/router.py
+++ b/wqflask/wqflask/api/router.py
@@ -3,7 +3,8 @@
from __future__ import absolute_import, division, print_function
import os, io, csv, json, datetime, requests
-from zipfile import ZipFile
+import zlib
+from zipfile import ZipFile, ZIP_DEFLATED
import StringIO
@@ -757,7 +758,7 @@ def get_genotypes(group_name, file_format="csv"):
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")
- with ZipFile(memory_file, 'w') as zf:
+ with ZipFile(memory_file, 'w', compression=ZIP_DEFLATED) as zf:
for this_file in [config_file, geno_file, gmap_file]:
zf.writestr(this_file.name.split("/")[-1], this_file.read())
zf.writestr("{0}_pheno.csv".format(group_name), phenotypes.content)