mirror of
https://github.com/MillironX/SequenceVariation.jl.git
synced 2024-11-22 21:39:55 +00:00
refactor: Replace BioGenerics functions for Edit with stubs
This commit is contained in:
parent
d702de31b6
commit
be731665bc
1 changed files with 7 additions and 13 deletions
20
src/Edit.jl
20
src/Edit.jl
|
@ -23,6 +23,13 @@ function Base.isless(x::Edit, y::Edit)
|
||||||
return leftposition(x) < leftposition(y)
|
return leftposition(x) < leftposition(y)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BioGenerics.leftposition(e::Edit)
|
||||||
|
return error("leftposition not implemented for type $(typeof(e))")
|
||||||
|
end
|
||||||
|
function BioGenerics.rightposition(e::Edit)
|
||||||
|
return error("rightposition not implemented for type $(typeof(e))")
|
||||||
|
end
|
||||||
|
|
||||||
struct DeletionEdit{S<:BioSequence,T<:BioSymbol} <: Edit{S,T}
|
struct DeletionEdit{S<:BioSequence,T<:BioSymbol} <: Edit{S,T}
|
||||||
position::UInt
|
position::UInt
|
||||||
length::UInt
|
length::UInt
|
||||||
|
@ -108,19 +115,6 @@ function Base.parse(::Type{<:Edit{Se,Sy}}, s::Union{String,SubString{String}}) w
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
BioGenerics.leftposition(e::Edit) = e.pos
|
|
||||||
function BioGenerics.rightposition(e::Edit)
|
|
||||||
if _mutation(e) isa Substitution
|
|
||||||
return leftposition(e)
|
|
||||||
elseif _mutation(e) isa Insertion
|
|
||||||
return leftposition(e) + 1
|
|
||||||
elseif _mutation(e) isa Deletion
|
|
||||||
return leftposition(e) + length(e) - 1
|
|
||||||
else
|
|
||||||
error("Unknown mutation type $(typeof(_mutation(e)))")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
_lendiff(edit::Edit)
|
_lendiff(edit::Edit)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue