From d8435be115d38d450a283f2ed4a8b212b192dce0 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Tue, 6 Dec 2022 11:04:23 -0600 Subject: [PATCH] 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. --- src/SequenceVariation.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SequenceVariation.jl b/src/SequenceVariation.jl index 18db51a..de19df1 100644 --- a/src/SequenceVariation.jl +++ b/src/SequenceVariation.jl @@ -233,6 +233,10 @@ function is_valid(v::Variant) for edit in v.edits pos = edit.pos 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 if op isa Substitution pos in valid_positions || return false