From 205617e321287cd0b9227d82e21725bf41c81a28 Mon Sep 17 00:00:00 2001 From: Adam English Date: Thu, 28 Nov 2024 10:37:58 -0600 Subject: [PATCH] Lower memory letting the dispatch do the writing skips the pulling in of the sorted result Fixed #229 and #245 --- truvari/utils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/truvari/utils.py b/truvari/utils.py index 8b23c36..1afc794 100644 --- a/truvari/utils.py +++ b/truvari/utils.py @@ -430,10 +430,7 @@ def compress_index_vcf(fn, fout=None, remove=True): if fout is None: fout = fn + '.gz' with tempfile.TemporaryDirectory() as tmpdirname: - m_tmp = make_temp_filename(tmpdir=tmpdirname, suffix='.vcf') - with open(m_tmp, 'w') as out_hdlr: - out_hdlr.write(bcftools.sort(fn, "--temp-dir", tmpdirname)) - pysam.tabix_compress(m_tmp, fout, force=True) + bcftools.sort(fn, "-o", fout, "-O", "z", "--temp-dir", tmpdirname, catch_stdout=False) pysam.tabix_index(fout, force=True, preset="vcf") if remove: os.remove(fn)