Mercurial > repos > sanbi-uwc > data_manager_fetch_refseq
comparison data_manager/fetch_refseq.py @ 3:4852eb1a75e5 draft
planemo upload for repository https://github.com/pvanheus/refseq_fasta_data_manager commit b682adad2c3c74567d23e1a5cf2bfcc3df1c96ae
author | sanbi-uwc |
---|---|
date | Fri, 07 Sep 2018 18:41:23 -0400 |
parents | a4ee45e7237b |
children | d878e492546c |
comparison
equal
deleted
inserted
replaced
2:a4ee45e7237b | 3:4852eb1a75e5 |
---|---|
50 open_output = open | 50 open_output = open |
51 with open_output(os.path.join(out_dir, output_filename), 'wb') as output_file: | 51 with open_output(os.path.join(out_dir, output_filename), 'wb') as output_file: |
52 while input_filename != 'STOP': | 52 while input_filename != 'STOP': |
53 if debug: | 53 if debug: |
54 print('Reading', input_filename, file=sys.stderr) | 54 print('Reading', input_filename, file=sys.stderr) |
55 with gzip.open(input_filename) as input_file: | 55 with gzip.open(input_filename, 'rb') as input_file: |
56 read_chunk = functools.partial(input_file.read, (chunk_size)) | 56 read_chunk = functools.partial(input_file.read, (chunk_size)) |
57 for data in iter(read_chunk, ''): # use '' as a sentinel to stop the loop | 57 for data in iter(read_chunk, b''): # use b'' as a sentinel to stop the loop. note '' != b'' in Python 3 |
58 output_file.write(data) | 58 output_file.write(data) |
59 os.unlink(input_filename) | 59 os.unlink(input_filename) |
60 input_filename = conn.get() | 60 input_filename = conn.get() |
61 | 61 |
62 def get_refseq_division(division_name, mol_types, output_directory, debug=False, compress=False): | 62 def get_refseq_division(division_name, mol_types, output_directory, debug=False, compress=False): |