Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use system temp files for temporary snf files #463

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/sniffles/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from argparse import Namespace
from dataclasses import dataclass
from typing import Optional, Union, Callable
import tempfile

import pysam

Expand Down Expand Up @@ -163,15 +164,15 @@ def execute(self) -> CallResult:
result = CallResult(self, svcalls, read_count)

if config.snf is not None: # and len(svcandidates):
snf_filename = f"{config.snf}.tmp_{self.id}.snf"
fd, snf_filename = tempfile.mkstemp()

with open(snf_filename, "wb") as handle:
with open(fd,"wb") as handle:
snf_out = snf.SNFile(config, handle)
for cand in svcandidates:
snf_out.store(cand)
snf_out.annotate_block_coverages(self.lead_provider)
snf_out.write_and_index()
handle.close()

result.snf_filename = snf_filename
result.snf_index = snf_out.get_index()
result.snf_total_length = snf_out.get_total_length()
Expand Down