Skip to content

Commit

Permalink
Merge pull request #142 from richardhj/patch-1
Browse files Browse the repository at this point in the history
Fix downloading refseq_gene_symbols.txt file
  • Loading branch information
korikuzma authored Aug 27, 2021
2 parents d41e9ee + 7e1f28e commit c9937d2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions variation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ def data_download(path, domain, dir, fn):
with FTP(domain) as ftp:
ftp.login()
ftp.cwd(dir)
with open(f"{path}.gz", 'wb') as fp:
if fn.endswith('.gz') and not path.endswith('.gz'):
path += ".gz"
with open(f"{path}", 'wb') as fp:
ftp.retrbinary(f'RETR {fn}', fp.write)
if fn.endswith('.gz'):
with gzip.open(f"{path}.gz", 'rb') as f_in:
with open(path, 'wb') as f_out:
with gzip.open(f"{path}", 'rb') as f_in:
dest = path[:-3]
with open(dest, 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
remove(f"{path}.gz")
remove(f"{path}")


SEQREPO_DATA_PATH = f"{APP_ROOT}/data/seqrepo/latest"
Expand Down

0 comments on commit c9937d2

Please sign in to comment.