Skip to content

Commit

Permalink
Ticket #185
Browse files Browse the repository at this point in the history
no region guard for refine
  • Loading branch information
ACEnglish committed Jan 4, 2024
1 parent 23af55e commit b93842c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions truvari/phab.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,17 @@ def merged_region_file(regions, buff=100):
m_dict[i[0]].append((max(0, i[1] - buff), i[2] + buff))

out_file_name = truvari.make_temp_filename()
n_reg = 0
with open(out_file_name, 'w') as fout:
for chrom in sorted(m_dict.keys()):
intvs = IntervalTree.from_tuples(m_dict[chrom])
intvs.merge_overlaps()
for i in sorted(intvs):
fout.write(f"{chrom}:{i.begin}-{i.end}\n")
n_reg += 1
if n_reg == 0:
logging.critical("No regions to be refined. Exiting")
sys.exit(0)
return out_file_name


Expand Down

0 comments on commit b93842c

Please sign in to comment.