Skip to content

Commit

Permalink
fix(call): don't allow eating into VCF anchor with ref offset
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Nov 20, 2024
1 parent a50a24f commit 444911d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions strkit/call/call_locus.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ def call_locus(
ref_right_flank_seq,
motif,
ref_size=right_coord-left_coord, # reference size, in terms of coordinates (not TRF-recorded size)
vcf_anchor_size=vcf_anchor_size, # guarantee we still have some flanking stuff left to anchor with
max_iters=ref_max_iters,
respect_coords=respect_ref,
local_search_range=ref_local_search_range,
Expand Down
3 changes: 2 additions & 1 deletion strkit/call/repeats.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def get_ref_repeat_count(
flank_right_seq: str,
motif: str,
ref_size: int,
vcf_anchor_size: int,
max_iters: int,
respect_coords: bool = False,
local_search_range: int = DEFAULT_LOCAL_SEARCH_RANGE, # TODO: Parametrize for user
Expand Down Expand Up @@ -154,7 +155,7 @@ 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):
if l_offset >= len(flank_left_seq) - vcf_anchor_size:
# 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
Expand Down

0 comments on commit 444911d

Please sign in to comment.