Mercurial > repos > cathywise > truststore_import
diff TrustStoreGalaxyImport.py @ 21:8cf18ca6f13f
ugh.
author | Catherine Wise <catherine.wise@csiro.au> |
---|---|
date | Mon, 13 Jan 2014 09:10:44 +1100 |
parents | b94a8f55b1da |
children | 1179f6e90e78 |
line wrap: on
line diff
--- a/TrustStoreGalaxyImport.py Mon Jan 13 08:51:17 2014 +1100 +++ b/TrustStoreGalaxyImport.py Mon Jan 13 09:10:44 2014 +1100 @@ -62,24 +62,23 @@ print "File is compressed (gzip) but not valid." sys.exit(4) elif is_gzipped and is_valid: - if link_data_only == 'copy_files': - # We need to uncompress the temp_name file, but BAM files must remain compressed in the BGZF format - CHUNK_SIZE = 2**20 # 1Mb - fd, uncompressed = tempfile.mkstemp(prefix='data_id_%s_upload_gunzip_' % dataset.dataset_id, dir=os.path.dirname(outputFile), text=False ) - gzipped_file = gzip.GzipFile(download, 'rb') - while 1: - try: - chunk = gzipped_file.read(CHUNK_SIZE) - except IOError: - os.close(fd) - os.remove(uncompressed) - print 'Problem decompressing gzipped data', dataset, json_file - sys.exit(4) - if not chunk: - break - os.write(fd, chunk) - os.close(fd) - gzipped_file.close() + # We need to uncompress the temp_name file, but BAM files must remain compressed in the BGZF format + CHUNK_SIZE = 2**20 # 1Mb + fd, uncompressed = tempfile.mkstemp(prefix='data_id_%s_upload_gunzip_' % dataset.dataset_id, dir=os.path.dirname(outputFile), text=False ) + gzipped_file = gzip.GzipFile(download, 'rb') + while 1: + try: + chunk = gzipped_file.read(CHUNK_SIZE) + except IOError: + os.close(fd) + os.remove(uncompressed) + print 'Problem decompressing gzipped data', dataset, json_file + sys.exit(4) + if not chunk: + break + os.write(fd, chunk) + os.close(fd) + gzipped_file.close() shutil.copy(uncompressed, outputFile) else: