From 21b0a4f5268c0ee6d957eafe40cc19e51fe2f1cf Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Tue, 1 Oct 2024 11:36:03 -0500 Subject: [PATCH] wip: formatting glitches from git absorb --- src/Edit.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Edit.jl b/src/Edit.jl index 739d277..212f7d5 100644 --- a/src/Edit.jl +++ b/src/Edit.jl @@ -61,13 +61,13 @@ BioGenerics.leftposition(d::DeletionEdit) = d.position BioGenerics.rightposition(d::DeletionEdit) = leftposition(d) + length(d) - 1 _lendiff(d::DeletionEdit) = -1 * length(d) -struct InsertionEdit{S<:BioSequence} <: Edit +struct InsertionEdit{S,T} <: Edit{S,T} position::UInt -struct InsertionEdit{S,T} <: Edit{S,T} where {S<:BioSequence,T<:BioSymbol} + seq::S - function InsertionEdit{S}(position::UInt, seq::S) where {S<:BioSequence} - iszero(position) && error("Insertion cannot be at a position outside the sequence") function InsertionEdit{S,T}(position::UInt, seq::S) where {S<:BioSequence,T<:BioSymbol} + iszero(position) && error("Insertion cannot be at a position outside the sequence") + isempty(seq) && error("Insertion must be at least 1 symbol") return new(position, seq) end end @@ -78,15 +78,15 @@ BioGenerics.leftposition(i::InsertionEdit) = i.position BioGenerics.rightposition(i::InsertionEdit) = leftposition(i) + 1 _lendiff(i::InsertionEdit) = length(i) -struct SubstitutionEdit{T} <: Edit where {T<:BioSymbol} +struct SubstitutionEdit{S,T} <: Edit{S,T} position::UInt -struct SubstitutionEdit{S,T} <: Edit{S,T} where {S<:BioSequence,T<:BioSymbol} + base::T - function SubstitutionEdit{T}(position::UInt, base::T) where {T<:BioSymbol} - iszero(position) && function SubstitutionEdit{S,T}( position::UInt, base::T ) where {S<:BioSequence,T<:BioSymbol} + iszero(position) && + error("Substitution cannot be at a position outside the sequence") return new(position, base) end end