Add Variation constructor based on edit parsing

This commit is contained in:
Thomas A. Christensen II 2022-06-14 14:48:39 -05:00
parent ade9b7e41d
commit 76d5b6059e
Signed by: millironx
GPG key ID: 139C07724802BC5D

View file

@ -341,6 +341,13 @@ end
Variation(ref::S, edit::Edit{S, T}) where {S, T} = Variation{S, T}(ref, edit) Variation(ref::S, edit::Edit{S, T}) where {S, T} = Variation{S, T}(ref, edit)
function Variation(ref::S, edit::AbstractString) where {S<:BioSequence}
T = eltype(ref)
e = parse(Edit{S,T}, edit)
return Variation{S,T}(ref, e)
end
function is_valid(v::Variation) function is_valid(v::Variation)
isempty(v.ref) && return false isempty(v.ref) && return false
op = v.edit.x op = v.edit.x