From f774ac464c3bd6a564a89013f6b5b667a7d54f60 Mon Sep 17 00:00:00 2001 From: jamesli124 <58196853+jamesli124@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:32:49 -0500 Subject: [PATCH] multi_wps checks intervals for start < stop, and raises a value error that includes the chromosome of the offending interval if an invalid interval is encountered. --- src/finaletoolkit/frag/_multi_wps.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/finaletoolkit/frag/_multi_wps.py b/src/finaletoolkit/frag/_multi_wps.py index b61dfe3..af83a27 100644 --- a/src/finaletoolkit/frag/_multi_wps.py +++ b/src/finaletoolkit/frag/_multi_wps.py @@ -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))