mirror of
https://github.com/MillironX/SequenceVariation.jl.git
synced 2024-11-24 22:29:55 +00:00
Add Variation-level validation for Variants
Testing indicates that some Variants (particularly those with insertions and/or clips at the send of the query sequence) will validate fine as a Variant, but will fail validation as a Variation. This problem is particularly annoying when constructing Variants in the REPL, as the creation will complete successfully, but the show of the Variant will error out. To fix this, leverage the existing validation of Variation to check each Edit within a Variant upon construction.
This commit is contained in:
parent
91c3acc85e
commit
d8435be115
1 changed files with 4 additions and 0 deletions
|
@ -233,6 +233,10 @@ function is_valid(v::Variant)
|
||||||
for edit in v.edits
|
for edit in v.edits
|
||||||
pos = edit.pos
|
pos = edit.pos
|
||||||
op = edit.x
|
op = edit.x
|
||||||
|
# Sanity check: for this to be a valid variant, it must be comprised of valid
|
||||||
|
# variations
|
||||||
|
is_valid(Variation(v.ref, edit)) || return false
|
||||||
|
|
||||||
# For substitutions we simply do not allow another modification of the same base
|
# For substitutions we simply do not allow another modification of the same base
|
||||||
if op isa Substitution
|
if op isa Substitution
|
||||||
pos in valid_positions || return false
|
pos in valid_positions || return false
|
||||||
|
|
Loading…
Reference in a new issue