From af4d120a593c673911a156043f864b358b6656fe Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Mon, 18 Nov 2024 18:02:20 -0500 Subject: [PATCH] fix(call): errors from offsetting the entire flank seq --- strkit/call/repeats.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/strkit/call/repeats.py b/strkit/call/repeats.py index dec855c..381c353 100644 --- a/strkit/call/repeats.py +++ b/strkit/call/repeats.py @@ -154,6 +154,13 @@ def get_ref_repeat_count( l_offset = rev_top_res[1][1] r_offset = fwd_top_res[1][1] + if l_offset >= len(flank_left_seq): + # don't do anything weird if we're removing the entire flank sequence + # TODO: this can be caused by NNNNNNN - see chr5:139453668-139454525 in GRCh38 + l_offset = 0 + if r_offset >= len(flank_right_seq): + r_offset = 0 # same here + if l_offset > 0: tr_seq = flank_left_seq[-1*l_offset:] + tr_seq # first, move a chunk of the left flank to the TR seq flank_left_seq = flank_left_seq[:-1*l_offset] # then, remove that chunk from the left flank