From f9058c5cb393a2a616535843eba15a3c2ed0f3b4 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 17 Dec 2022 14:59:59 -0600 Subject: [PATCH] Update ranges to allow end position insertions --- src/SequenceVariation.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SequenceVariation.jl b/src/SequenceVariation.jl index a5ea12c..fa6aa2c 100644 --- a/src/SequenceVariation.jl +++ b/src/SequenceVariation.jl @@ -246,7 +246,7 @@ function is_valid(v::Variant) # for next op. However, we cannot have two insertions at the same position, because # then the order of them is ambiguous elseif op isa Insertion - pos in (first(valid_positions)-1+last_was_insert:last(valid_positions)) || return false + pos in (first(valid_positions)-1+last_was_insert:last(valid_positions)+1) || return false last_was_insert = true # Deletions obviously invalidate the reference bases that are deleted. elseif op isa Deletion @@ -399,7 +399,7 @@ function is_valid(v::Variation) if op isa Substitution return pos in eachindex(v.ref) elseif op isa Insertion - return pos in 0:lastindex(v.ref) + return pos in 0:lastindex(v.ref)+1 elseif op isa Deletion return pos in 1:(lastindex(v.ref)-length(op) + 1) end