Skip to content

Commit

Permalink
open files later and close files
Browse files Browse the repository at this point in the history
  • Loading branch information
LaraFuhrmann committed Aug 9, 2024
1 parent 279cc63 commit b69c793
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions viloca/b2w.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,6 @@ def parallel_run_one_window(
threads=1
)

reads = open(f"reads_{idx}.fas", "w")

logging.info(f"Working on window (1-based) @ {window_start+1}")

# (arr, arr_read_qualities_summary, arr_read_summary,
Expand Down Expand Up @@ -388,6 +386,7 @@ def parallel_run_one_window(
else:
end_extended_by_a_window = region_end + window_length*3

reads = open(f"reads_{idx}.fas", "w")
for read in arr_read_summary:
if idx == len(tiling) - 1 and read[1] > end_extended_by_a_window:
continue
Expand Down
4 changes: 2 additions & 2 deletions viloca/shotgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def parse_aligned_reads(reads_file):
# end index of the aligned read w.r.t reference (1-based indexing)
out_reads[name][3] = int(mstop)
out_reads[name][4] = this_m

handle.close()
return out_reads


Expand Down Expand Up @@ -311,7 +311,7 @@ def win_to_run(alpha_w, seed, inference_type, n_max_haplotypes, n_mfa_starts, un
if not os.path.isfile(output_name):
j = min(300_000, int(cov) * 15)
rn_list.append((winFile, j, alpha_w, seed, inference_type, n_max_haplotypes, n_mfa_starts, unique_modus, inference_convergence_threshold))

file1.close()
del end
del(beg, chr1)
return rn_list
Expand Down

0 comments on commit b69c793

Please sign in to comment.