From c9dabb8a97b9de9cdab37d1f23e07f4705848984 Mon Sep 17 00:00:00 2001 From: LaraFuhrmann <55209716+LaraFuhrmann@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:47:27 +0200 Subject: [PATCH] fix last window going over the end of reference seq --- viloca/tiling.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/viloca/tiling.py b/viloca/tiling.py index 5a2ab77..fef0e02 100644 --- a/viloca/tiling.py +++ b/viloca/tiling.py @@ -105,7 +105,7 @@ def get_window_tilings(self) -> List[Tuple[int, int]]: )) while window_positions[-1] + self.window_length >= self.end: del window_positions[-1] # FIXME uncommented to create one single window - window_positions.append(self.end - 1 - self.window_length) + #window_positions.append(self.end - 1 - self.window_length) else: window_positions = list(range( @@ -120,7 +120,11 @@ def get_window_tilings(self) -> List[Tuple[int, int]]: if self.exact_conformance_overlap_at_boundary == True: window_positions.append(window_positions[-1] + self.incr) - return [(i, self.window_length) for i in window_positions] + tiling = [(i, self.window_length) for i in window_positions] + if tiling[-1][0] + tiling[-1][1] >= self.end: + tiling[-1][1] = self.end-1 -tiling[-1][0] + + return tiling def get_reference_name(self): return self.reference_name