Skip to content

Commit

Permalink
multi_wps checks intervals for start < stop, and raises a value error…
Browse files Browse the repository at this point in the history
… that includes the chromosome of the offending interval if an invalid interval is encountered.
  • Loading branch information
jamesli124 committed Jan 14, 2025
1 parent bb44df7 commit f774ac4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/finaletoolkit/frag/_multi_wps.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ def multi_wps(
for line in bed:
contents = line.split()
contig = contents[0].strip()
if int(contents[1]) > int(contents[2]):
raise ValueError(
f"[multi_wps] {contig}:{contents[1]}-{contents[2]} is "
"invalid. Please be sure start coordinate occurs before "
f"stop for all intervals in {site_bed}.")
midpoint = (int(contents[1]) + int(contents[2])) // 2

start = max(0, midpoint + int(left_of_site))
Expand Down

0 comments on commit f774ac4

Please sign in to comment.