API Reference
Edits
SequenceVariation.Substitution — TypeSubstitutionRepresents the presence of a T at a given position. The position is stored outside this struct.
SequenceVariation.Deletion — TypeDeletionRepresents the deletion of N symbols. The location of the deletion is stored outside this struct
SequenceVariation.Insertion — TypeInsertion{S <: BioSequence}Represents the insertion of a S into a sequence. The location of the insertion is stored outside the struct.
Variants
SequenceVariation.Haplotype — TypeHaplotype{S<:BioSequence,T<:BioSymbol}A set of variations within a given sequence that are all found together. Depending on the field, it might also be referred to as a "genotype" or "strain."
Constructors
Haplotype(ref::S, edits::Vector{Edit{S,T}}) where {S<:BioSequence,T<:BioSymbol}
Haplotype(ref::S, vars::Vector{Variation{S,T}}) where {S<:BioSequence,T<:BioSymbol}
Haplotype(
aln::PairwiseAlignment{T,T}
) where {T<:LongSequence{<:Union{BS.AminoAcidAlphabet,BS.NucleicAcidAlphabet}}}When constructing a Haplotype from a vector of Edits or Variations, the edits are applied sequentially from first to last position, therefore the vector must always be sorted by position. These edits are sorted automatically if constructing from an alignment.
SequenceVariation.reference — Methodreference(h::Haplotype)Gets the reference sequence of h.
SequenceVariation.variations — FunctionSequenceVariation.reconstruct — Functionreconstruct(h::Haplotype)Apply the edits in h to the reference sequence of h and return the mutated sequence
SequenceVariation.translate — Methodtranslate(hap::Haplotype{S,T}, aln::PairwiseAlignment{S,S}) where {S,T}Convert the variations in hap to a new reference sequence based upon aln. The alignment rules follow the conventions of translate(::Variation, PairwiseAlignment). Indels at the beginning or end may not be preserved. Returns a new Haplotype
Variations
SequenceVariation.Variation — TypeVariation{S<:BioSequence,T<:BioSymbol}A single change to a biological sequence. A general wrapper that can represent a sequence-specific Substitution, Deletion or Insertion. Variation is more robust than Edit, due to inclusion of the reference sequence and built-in validation.
Constructors
Variation(ref::S, e::Edit{S,T}) where {S<:BioSequence,T<:BioSymbol}
Variation(ref::S, edit::AbstractString) where {S<:BioSequence}Generally speaking, the Edit constructor should be avoided to ensure corectness: use of variations(::Haplotype) is encouraged, instead.
Constructing a Variation from an AbstractString will parse the from edit using the following syntax:
- Substitution:
"<REFBASE><POS><ALTBASE>", e.g."G16C" - Deletion:
"Δ<STARTPOS>-<ENDPOS>", e.g."Δ1-2" - Insertion:
"<POS><ALTBASES>", e.g."11T"
SequenceVariation.reference — Methodreference(v::Variation)Gets the reference sequence of v
SequenceVariation.mutation — Functionmutation(v::Variation)Gets the underlying Substitution, Insertion, or Deletion of v.
SequenceVariation.translate — Methodtranslate(var::Variation{S,T}, aln::PairwiseAlignment{S,S}) where {S,T}Convert the difference in var to a new reference sequence based upon aln. aln is the alignment of the old reference (aln.b) and the new reference sequence (aln.seq). Returns the new Variation.
SequenceVariation.refbases — Functionrefbases(v::Variation)Get the reference bases of v. Note that for deletions, refbases also returns the base before the deletion in accordance with the REF field of the VCF v4 specification.
SequenceVariation.altbases — Functionaltbases(v::Variation)Get the alternate bases of v. Note that for insertions, altbases also returns the base before the insertion in accordance with the ALT field of the VCF v4 specification.
Private API
Edits
SequenceVariation.Edit — TypeEdit{S <: BioSequence, T <: BioSymbol}An edit of either Substitution{T}, Insertion{S} or Deletion at a position. If deletion: Deletion of length L at ref pos pos:pos+L-1 If insertion: Insertion of length L b/w ref pos pos:pos+1
SequenceVariation._mutation — Function_mutation(e::Edit)Returns the underlying Substitution, Insertion, or Deletion of e.
SequenceVariation._lendiff — Function_lendiff(edit::Edit)Gets the number of bases that edit adds to the reference sequence
Variants
SequenceVariation._edits — Function_edits(h::Haplotype)Gets the Edits that comprise h
SequenceVariation._is_valid — Method_is_valid(h::Haplotype{S,T}) where {S,T}Validate h. h is invalid if any of its operations are out of bounds, or the same position is affected by multiple edits.
Variations
SequenceVariation._edit — Function_edit(v::Variation)Gets the underlying Edit of v
SequenceVariation._is_valid — Method_is_valid(v::Variation)Validate v. v is invalid if its opertation is out of bounds.