mirror of
https://github.com/MillironX/SequenceVariation.jl.git
synced 2024-11-21 21:16:05 +00:00
Add tests for _is_valid(::Haplotype)
This commit is contained in:
parent
57ebe391bf
commit
7bd39b1d54
1 changed files with 23 additions and 0 deletions
|
@ -45,6 +45,9 @@ seq2 = ungap!(dna"TGATGCGTGT-AGCAACACTTATAGCG")
|
|||
seq3 = ungap!(dna"-GATGCGTGT-AGCAACACTTATCGC-")
|
||||
var = Haplotype(align(seq1, seq2))
|
||||
|
||||
const SEQ = typeof(seq1)
|
||||
const BSE = eltype(seq1)
|
||||
|
||||
@testset "EditSorting" begin
|
||||
S = typeof(seq1)
|
||||
T = eltype(seq1)
|
||||
|
@ -55,6 +58,11 @@ var = Haplotype(align(seq1, seq2))
|
|||
end
|
||||
|
||||
@testset "HaplotypeValidation" begin
|
||||
# Test that we can't use an empty reference
|
||||
@test_throws ErrorException Haplotype(
|
||||
dna"", [SequenceVariation.Edit{SEQ,BSE}(Insertion{SEQ}(dna"A"), 0)]
|
||||
)
|
||||
|
||||
# Test that substitutions cannot share the same position
|
||||
@test_throws ErrorException Haplotype(
|
||||
seq2, [Variation(seq2, "T2A"), Variation(seq2, "T2C")]
|
||||
|
@ -87,6 +95,21 @@ end
|
|||
@test_throws ErrorException Haplotype(
|
||||
seq2, [Variation(seq2, "Δ2-6"), Variation(seq2, "Δ3-5")]
|
||||
)
|
||||
|
||||
# Test that a complicated (but valid) Haplotype still checks out
|
||||
@test first(
|
||||
SequenceVariation._is_valid(
|
||||
Haplotype(
|
||||
seq2,
|
||||
[
|
||||
Variation(seq2, "0AAA"),
|
||||
Variation(seq2, "T2A"),
|
||||
Variation(seq2, "Δ5-8"),
|
||||
Variation(seq2, "G26A"),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
end
|
||||
|
||||
@testset "HaplotypeRoundtrip" begin
|
||||
|
|
Loading…
Reference in a new issue