Skip to content

Commit e757380

Browse files
committed
Fix tmp dir output for bcftools sort
1 parent 9808138 commit e757380

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

meteor/variantcalling.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def run_freebayes_chunk(
4343
min_snp_depth: int,
4444
min_frequency: float,
4545
ploidy: int,
46+
tmp_dir: Path,
4647
):
4748
"""Function to run freebayes on a chunk of the BED file (i.e., a portion of the genome)."""
4849
try:
@@ -89,7 +90,7 @@ def run_freebayes_chunk(
8990
with vcf_chunk_file.open("wb") as raw:
9091
with bgzip.BGZipWriter(raw) as fh:
9192
fh.write(freebayes_output)
92-
bcftools.sort('-Oz', '-o', str(vcf_chunk_file.resolve()), str(vcf_chunk_file.resolve()), catch_stdout=False)
93+
bcftools.sort('-Oz', '-o', str(vcf_chunk_file.resolve()), '-T', str(tmp_dir), str(vcf_chunk_file.resolve()), catch_stdout=False)
9394
tabix_index(str(vcf_chunk_file.resolve()), preset="vcf", force=True)
9495
else:
9596
logging.error(
@@ -645,6 +646,7 @@ def execute(self) -> None:
645646
self.min_snp_depth,
646647
self.min_frequency,
647648
self.ploidy,
649+
self.meteor.tmp_dir,
648650
): bed_chunk_file
649651
for bed_chunk_file, vcf_chunk_file in zip(
650652
bed_chunks, vcf_chunk_files
@@ -678,7 +680,7 @@ def execute(self) -> None:
678680
startindexing = perf_counter()
679681
if not Path(f"{vcf_file}.tbi").exists():
680682
logging.info("Indexing")
681-
bcftools.sort('-Oz','-o', str(vcf_file.resolve()), str(vcf_file.resolve()), catch_stdout=False)
683+
bcftools.sort('-Oz','-o', str(vcf_file.resolve()), '-T', str(self.meteor.tmp_dir), str(vcf_file.resolve()), catch_stdout=False)
682684
tabix_index(str(vcf_file.resolve()), preset="vcf", force=True)
683685
else:
684686
logging.info("Index already exist, skipping...")

0 commit comments

Comments
 (0)