mirror of
https://github.com/MillironX/SequenceVariation.jl.git
synced 2024-11-22 13:29:56 +00:00
Fix inconsistent Variation positions (#4)
* Change Variant constructor to use alignment positions Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> * Add test for positions of Variations Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com>
This commit is contained in:
parent
d0f0f65d7f
commit
ade9b7e41d
2 changed files with 14 additions and 2 deletions
|
@ -242,7 +242,8 @@ function Variant(aln::PairwiseAlignment{T, T}) where {T <: LongSequence{<:Union{
|
||||||
E = eltype(typeof(ref))
|
E = eltype(typeof(ref))
|
||||||
edits = Edit{T, E}[]
|
edits = Edit{T, E}[]
|
||||||
result = Variant(ref, edits)
|
result = Variant(ref, edits)
|
||||||
refpos = seqpos = 0
|
refpos = first(aln.a.aln.anchors).refpos
|
||||||
|
seqpos = first(aln.a.aln.anchors).seqpos
|
||||||
markpos = 0
|
markpos = 0
|
||||||
n_gaps = n_ins = 0
|
n_gaps = n_ins = 0
|
||||||
insertion_buffer = E[]
|
insertion_buffer = E[]
|
||||||
|
|
|
@ -33,3 +33,14 @@ align(a::BioSequence, b::BioSequence) = pairalign(GlobalAlignment(), a, b, DNA_M
|
||||||
seq1 = ungap!(dna"--ATGCGTGTTAGCAAC--TTATCGCG")
|
seq1 = ungap!(dna"--ATGCGTGTTAGCAAC--TTATCGCG")
|
||||||
seq2 = ungap!(dna"TGATGCGTGT-AGCAACACTTATAGCG")
|
seq2 = ungap!(dna"TGATGCGTGT-AGCAACACTTATAGCG")
|
||||||
var = Variant(align(seq1, seq2))
|
var = Variant(align(seq1, seq2))
|
||||||
|
|
||||||
|
@testset "VariationPosition" begin
|
||||||
|
refseq = dna"ACAACTTTATCT"
|
||||||
|
mutseq = dna"ACATCTTTATCT"
|
||||||
|
|
||||||
|
read01 = AlignedSequence(mutseq[1:10], Alignment("10M", 1, 1))
|
||||||
|
read02 = AlignedSequence(mutseq[3:12], Alignment("10M", 1, 3))
|
||||||
|
aln01 = PairwiseAlignment(read01, refseq)
|
||||||
|
aln02 = PairwiseAlignment(read02, refseq)
|
||||||
|
@test Variant(aln01).edits == Variant(aln02).edits
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue