diff --git a/src/Haplotype.jl b/src/Haplotype.jl index f5cf985..9164455 100644 --- a/src/Haplotype.jl +++ b/src/Haplotype.jl @@ -250,6 +250,17 @@ function BioAlignments.cigar(hap::Haplotype{S,T}) where {S,T} return join(cigar_string, "") 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} diff --git a/src/SequenceVariation.jl b/src/SequenceVariation.jl index 37b0a42..e8e7210 100644 --- a/src/SequenceVariation.jl +++ b/src/SequenceVariation.jl @@ -20,7 +20,15 @@ TODO now: * 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 BioSequences: BioSequences, BioSequence, NucleotideSeq, LongSequence, isgap using BioSymbols: BioSymbol