Add accessor functions for Variation properties

This commit is contained in:
Thomas A. Christensen II 2022-06-14 16:20:39 -05:00
parent 1e6f6ea075
commit 2d05b233a9
Signed by: millironx
GPG key ID: 139C07724802BC5D

View file

@ -20,9 +20,10 @@ TODO now:
* Add tests * Add tests
""" """
using BioSymbols: BioSymbol
using BioAlignments: BioAlignments, PairwiseAlignment using BioAlignments: BioAlignments, PairwiseAlignment
using BioGenerics: BioGenerics, leftposition
using BioSequences: BioSequences, BioSequence, NucleotideSeq, AminoAcidSeq, LongSequence, isgap using BioSequences: BioSequences, BioSequence, NucleotideSeq, AminoAcidSeq, LongSequence, isgap
using BioSymbols: BioSymbol
const BA = BioAlignments const BA = BioAlignments
const BS = BioSequences const BS = BioSequences
@ -351,6 +352,11 @@ function Variation(ref::S, edit::AbstractString) where {S<:BioSequence}
return Variation{S,T}(ref, e) return Variation{S,T}(ref, e)
end end
reference(v::Variation) = v.reference
edit(v::Variation) = v.edit
mutation(v::Variation) = mutation(edit(v))
BioGenerics.leftposition(v::Variation) = leftposition(edit(v))
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
@ -436,6 +442,8 @@ export Insertion,
Deletion, Deletion,
Substitution, Substitution,
Variant, Variant,
Variation Variation,
reference,
mutation
end # module end # module