SequenceVariation.jl/docs/src/compare.md

48 lines
1.5 KiB
Markdown
Raw Normal View History

2023-01-03 22:01:59 +00:00
```@meta
CurrentModule = SequenceVariation
```
# Comparing variations in sequences
## Checking for variations in a known haplotype
2023-01-03 22:01:59 +00:00
2023-01-04 18:45:25 +00:00
Looking for a known [`Variation`](@ref) within a [`Haplotype`](@ref) is
2023-01-03 22:01:59 +00:00
efficiently accomplished using the `in` operator.
```@setup call_variants
using SequenceVariation, BioAlignments, BioSequences
bovine = dna"GACCGGCTGCATTCGAGGCTGCCAGCAAGCAG";
ovine = dna"GACCGGCTGCATTCGAGGCTGTCAGCAAACAG";
human = dna"GACAGGCTGCATCAGAAGAGGCCATCAAGCAG";
bos_ovis_alignment =
PairwiseAlignment(AlignedSequence(ovine, Alignment("32M", 1, 1)), bovine);
bos_human_alignment =
PairwiseAlignment(AlignedSequence(human, Alignment("32M", 1, 1)), bovine);
bos_ovis_haplotype = Haplotype(bos_ovis_alignment)
bos_human_haplotype = Haplotype(bos_human_alignment)
2023-01-03 22:01:59 +00:00
```
```@example call_variants
println("\tOvis aires\tHomo sapiens")
for v in vcat(variations(bos_ovis_haplotype), variations(bos_human_haplotype))
is_sheep = v in bos_ovis_haplotype
is_human = v in bos_human_haplotype
2023-01-03 22:01:59 +00:00
println("$v\t$is_sheep\t\t$is_human")
end
```
## Constructing new haplotypes based on other variations
2023-01-03 22:01:59 +00:00
New haplotypes can be constructed using variations. This might be useful to pool
variations found on different reads or to filter variations from a haplotype
that aren't validated by another haplotype.
2023-01-03 22:01:59 +00:00
```@repl call_variants
sheeple = vcat(variations(bos_ovis_haplotype), variations(bos_human_haplotype));
2023-01-04 18:45:25 +00:00
Haplotype(bovine, sheeple)
2023-01-03 22:01:59 +00:00
reconstruct!(bovine, ans)
```