Working with individual variations
Construction
Individual Variation
s can be made using a reference sequence and string syntax
Variation type | Syntax | Interpretation | Example |
---|---|---|---|
Substitutions | <REF><POS><ALT> | <ALT> is substituted for <REF> in position <POS> | "G16C" |
Deletions | Δ<START>-<END> | All bases (inclusive) between <START> and <END> are deleted. It is valid to have <START> equal <END> : that is a deletion of one base. | "Δ1-2" |
Insertions | <POS><ALT> | <ALT> is inserted between positions <POS> and <POS>+1 | "11T" |
julia> using BioSequences: @dna_str
julia> using SequenceVariation
julia> bovine_ins = dna"GACCGGCTGCATTCGAGGCTGCCAGCAAGCAG"
32nt DNA Sequence: GACCGGCTGCATTCGAGGCTGCCAGCAAGCAG
julia> Variation(bovine_ins, "C4A")
C4A
julia> mutation(ans)
Substitution{BioSymbols.DNA}(DNA_A)
julia> typeof(mutation(Variation(bovine_ins, "Δ13-14")))
Deletion
julia> mutation(Variation(bovine_ins, "25ACA"))
Insertion{BioSequences.LongSequence{BioSequences.DNAAlphabet{4}}}(ACA)
Extraction
Sequence variations may also be extracted wholesale from a Haplotype
using the variations
function.
julia> variations(bos_ovis_haplotype)
2-element Vector{Variation{BioSequences.LongSequence{BioSequences.DNAAlphabet{4}}, BioSymbols.DNA}}: C22T G29A
julia> variations(bos_human_haplotype)
7-element Vector{Variation{BioSequences.LongSequence{BioSequences.DNAAlphabet{4}}, BioSymbols.DNA}}: C4A T13C C14A G17A C19A T20G G25T
Reference switching
An individual variation can be mapped to a new reference sequence given an alignment between the new and old references using the translate
function.
julia> ovis_human_alignment = PairwiseAlignment(AlignedSequence(human, Alignment("32M", 1, 1)), ovine)
BioAlignments.PairwiseAlignment{BioSequences.LongSequence{BioSequences.DNAAlphabet{4}}, BioSequences.LongSequence{BioSequences.DNAAlphabet{4}}}: seq: 1 GACAGGCTGCATCAGAAGAGGCCATCAAGCAG 32 ||| |||||||| || | | || ||| ||| ref: 1 GACCGGCTGCATTCGAGGCTGTCAGCAAACAG 32
julia> human_variation = first(variations(bos_ovis_haplotype))
C22T
julia> reference(ans) == bovine
true
julia> SequenceVariation.translate(human_variation, ovis_human_alignment)
C22T
julia> reference(ans) == bovine
false