Skip to content

Commit

Permalink
Fixes #381 closes all .tmp files opened by .save_seqs (#382)
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Inzani <pi2@sanger.ac.uk>
Co-authored-by: Ryan Dale <ryan.dale@nih.gov>
  • Loading branch information
3 people authored Jul 1, 2023
1 parent 4b386cb commit 5350e38
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pybedtools/bedtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5350e38

Please sign in to comment.