mirror of
https://github.com/MillironX/SequenceVariation.jl.git
synced 2024-11-25 22:59:56 +00:00
Refactor _lendiff to use multiple dispatch
This commit is contained in:
parent
cab3029bc6
commit
dd405c5f4b
1 changed files with 4 additions and 2 deletions
|
@ -57,6 +57,8 @@ function BioGenerics.rightposition(e::Edit)
|
||||||
end
|
end
|
||||||
|
|
||||||
function lendiff(edit::Edit)
|
function lendiff(edit::Edit)
|
||||||
x = edit.x
|
x = _mutation(edit)
|
||||||
return x isa Substitution ? 0 : (x isa Deletion ? -length(x) : length(x.x))
|
# Each edit type has logic for its length, we just need to know what direction to go
|
||||||
|
multiplier = x isa Substitution ? 0 : (x isa Deletion ? -1 : 1)
|
||||||
|
return length(x) * multiplier
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue