From 5350e38c87b5f779b9c11a073cf32bded896a428 Mon Sep 17 00:00:00 2001 From: PeterRobots <119803540+PeterRobots@users.noreply.github.com> Date: Sat, 1 Jul 2023 21:38:54 +0100 Subject: [PATCH] Fixes #381 closes all .tmp files opened by .save_seqs (#382) Co-authored-by: Peter Inzani Co-authored-by: Ryan Dale --- pybedtools/bedtool.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pybedtools/bedtool.py b/pybedtools/bedtool.py index 8233e115..e5826e2d 100644 --- a/pybedtools/bedtool.py +++ b/pybedtools/bedtool.py @@ -2712,9 +2712,11 @@ def save_seqs(self, fn): if not hasattr(self, "seqfn"): raise ValueError("Use .sequence(fasta) to get the sequence first") + with open(fn, "w") as fout: with open(self.seqfn) as seqfile: fout.write(seqfile.read()) + new_bedtool = BedTool(self.fn) new_bedtool.seqfn = fn return new_bedtool