mirror of
https://github.com/MillironX/SequenceVariation.jl.git
synced 2024-11-22 21:39:55 +00:00
feat: Add _cigar(::Variation) function
Add a function that can convert the information contained in an Insertion or a Deletion into a CIGAR operator.
This commit is contained in:
parent
011651857f
commit
c3a7788dbd
1 changed files with 15 additions and 0 deletions
|
@ -120,6 +120,21 @@ function Base.in(v::Variation, var::Haplotype)
|
||||||
return any(v.edit == edit for edit in var.edits)
|
return any(v.edit == edit for edit in var.edits)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
_cigar(var::Variation{S,T}) where {S,T}
|
||||||
|
|
||||||
|
Returns a CIGAR operation for `var`. Only supports insertions and deletions.
|
||||||
|
|
||||||
|
See also [`_cigar_between`](@ref)
|
||||||
|
"""
|
||||||
|
function _cigar(var::Variation{S,T}) where {S,T}
|
||||||
|
mut = mutation(var)
|
||||||
|
mut isa Union{Deletion,Insertion} ||
|
||||||
|
throw(ArgumentError("var must be an Insertion or Deletion"))
|
||||||
|
cigar_letter = mut isa Deletion ? 'D' : 'I'
|
||||||
|
return string(length(mut), cigar_letter)
|
||||||
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
translate(var::Variation{S,T}, aln::PairwiseAlignment{S,S}) where {S,T}
|
translate(var::Variation{S,T}, aln::PairwiseAlignment{S,S}) where {S,T}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue