Skip to content

Commit

Permalink
Try exports to gz as it stalls with larger files (MC3 dataset) strang…
Browse files Browse the repository at this point in the history
…ely...
  • Loading branch information
krassowski committed Jun 6, 2017
1 parent f44b93a commit 55c5c7c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions website/imports/mutations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gzip
from abc import ABC
from abc import abstractmethod
from collections import defaultdict
Expand Down Expand Up @@ -285,7 +286,7 @@ def export(self, path=None, only_primary_isoforms=False):
directory = os.path.join('exported', 'mutations')
os.makedirs(directory, exist_ok=True)

name_template = '{model_name}{restrictions}-{date}.tsv'
name_template = '{model_name}{restrictions}-{date}.tsv.gz'

name = name_template.format(
model_name=self.model_name,
Expand All @@ -305,7 +306,7 @@ def export(self, path=None, only_primary_isoforms=False):
elif isinstance(self.model, InheritedMutation):
header += ['disease']

with open(path, 'w') as f:
with gzip.open(path, 'w') as f:
f.write('\t'.join(header))

for mutation in tqdm(self.model.query.all()):
Expand Down

0 comments on commit 55c5c7c

Please sign in to comment.