mirror of
https://github.com/MillironX/SequenceVariation.jl.git
synced 2024-11-25 14:49:55 +00:00
feat: Add _cigar_between(::Variation, ::Variation) function
Add a function that can calculate the matching bases between two (non-matching) Variations and return a matching (M) CIGAR operation
This commit is contained in:
parent
c3a7788dbd
commit
e84f765357
1 changed files with 20 additions and 0 deletions
|
@ -135,6 +135,26 @@ function _cigar(var::Variation{S,T}) where {S,T}
|
|||
return string(length(mut), cigar_letter)
|
||||
end
|
||||
|
||||
"""
|
||||
_cigar_between(x::Variation{S,T}, y::Variation{S,T}) where {S,T}
|
||||
|
||||
Returns a CIGAR operation for the (assumed) matching bases between `x` and `y`.
|
||||
|
||||
See also [`_cigar`](@ref)
|
||||
"""
|
||||
function _cigar_between(x::Variation{S,T}, y::Variation{S,T}) where {S,T}
|
||||
x == y && return ""
|
||||
match_length = leftposition(y) - rightposition(x)
|
||||
if mutation(y) isa Insertion
|
||||
match_length -= 1
|
||||
end
|
||||
if mutation(y) isa Deletion
|
||||
match_length += 1
|
||||
end
|
||||
match_length > 0 || return ""
|
||||
return "$(match_length)M"
|
||||
end
|
||||
|
||||
"""
|
||||
translate(var::Variation{S,T}, aln::PairwiseAlignment{S,S}) where {S,T}
|
||||
|
||||
|
|
Loading…
Reference in a new issue