feat: Add alignment(::Haplotype) function

This commit is contained in:
Thomas A. Christensen II 2023-04-04 11:50:24 -05:00
parent 95ef4fdc62
commit 4817c8016a
Signed by: millironx
GPG key ID: 09335146883990B9
2 changed files with 20 additions and 1 deletions

View file

@ -250,6 +250,17 @@ function BioAlignments.cigar(hap::Haplotype{S,T}) where {S,T}
return join(cigar_string, "") return join(cigar_string, "")
end end
"""
alignment(hap::Haplotype)
Gets a `PairwiseAlignment` of the mutated sequence of `hap` mapped to its refernce sequence
"""
function BioAlignments.alignment(hap::Haplotype)
return PairwiseAlignment(
AlignedSequence(reconstruct(hap), Alignment(cigar(hap))), reference(hap)
)
end
""" """
translate(hap::Haplotype{S,T}, aln::PairwiseAlignment{S,S}) where {S,T} translate(hap::Haplotype{S,T}, aln::PairwiseAlignment{S,S}) where {S,T}

View file

@ -20,7 +20,15 @@ TODO now:
* Add tests * Add tests
""" """
using BioAlignments: BioAlignments, PairwiseAlignment, OP_SOFT_CLIP, cigar, sequence using BioAlignments:
BioAlignments,
Alignment,
AlignedSequence,
PairwiseAlignment,
OP_SOFT_CLIP,
alignment,
cigar,
sequence
using BioGenerics: BioGenerics, leftposition, rightposition using BioGenerics: BioGenerics, leftposition, rightposition
using BioSequences: BioSequences, BioSequence, NucleotideSeq, LongSequence, isgap using BioSequences: BioSequences, BioSequence, NucleotideSeq, LongSequence, isgap
using BioSymbols: BioSymbol using BioSymbols: BioSymbol