def compress_vcf(self):
"""
Compresses vcf file using bgzip.
Returns
-------
bool
True if successful
Raises
-------
RuntimeError
If return code from external call is not 0
"""
self.logger.info("Compressing vcf file {}".format(self.filepath))
bgzip_start = time.time()
rc = subprocess.call([self.bgzip, "-f", self.filepath])
if rc == 0:
self.logger.info("Compression complete. Elapsed time: {} seconds".format(
time.time() - bgzip_start))
self.filepath = self.filepath + ".gz"
return True
else:
self.logger.error("Unable to compress vcf file: {}. Exiting.".format(
self.filepath))
logging.shutdown()
raise RuntimeError("Unable to compress vcf file. Exiting.")
评论列表
文章目录