Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CodingChange ¶
type CodingChange struct { CodingPos int ProteinPos int RemovedAa []dna.AminoAcid AddedAa []dna.AminoAcid Type EffectType }
CodingChange describes a change of a protein sequence caused by a mutation affecting the coding sequence of the corresponding gene. CodingPos and ProteinPos refer to the zero-based start position of the change. The CodingPos always refers to the position changed in origin DNA sequence, however ProteinPos is not always equal to CodingPos / 3. If a change would result in a RemovedAa[0] == AddedAa[0] the first amino acid from each slice is removed and ProteinPos += 1.
RemovedAa records all amino acids that are removed from the protein sequence. AddedAa records all amino acids that are added to the protein sequence. Substitution of one amino acid for another is reported as the original amino acid being removed, and the new amino acid being added. dna.Stop is included in RemovedAa and AddedAa.
type Deletion ¶
Deletion describes a sequence deletion. Start and End are the 0-base left-closed right-open interval being deleted (e.g. ATG del [1,2) -> AG).
type Delins ¶
Delins describes a combined insertion and a deletion of a sequence. Useful for describing complex variants. Start and End are the 0-base left-closed right-open interval being deleted (e.g. ATG del [1,3) ins C -> AC).
func (Delins) Effect ¶
Effect for Delins determines a coding change resulting from a combined deletion and insertion.
func (Delins) Mutate ¶
Mutate for Delins attempts to make a combined deletion and insertion directly in the input sequence. If the input []dna.Base does not have the capacity to store the resulting sequence, a new slice is allocated. Note that this will change the input sequence, even if the return slice is saved to a different variable.
type EffectType ¶
type EffectType byte
EffectType describes the overall effect of a CodingChange. Possible EffectTypes are described below.
const ( Silent EffectType = 6 // mutation changes codon, but still codes for the same amino acid Frameshift EffectType = 5 // shifts reading frame Nonsense EffectType = 4 // premature termination InFrameInsertion EffectType = 3 // insertion where insertedBases % 3 == 0 InFrameDeletion EffectType = 2 // deletion where deletedBases % 3 == 0 Missense EffectType = 1 // mutation changes coded amino acid )
type Effector ¶
type Effector interface {
Effect(codingSeq []dna.Base, offsetStart int, offsetEnd int) (CodingChange, error)
}
Effector is satisfied by types that implement the Effect method, which returns a CodingChange describing how changes prescribed by the receiver type alter the resulting amino acid sequence corresponding to the input []dna.Base. The input sequence should be the CDS of a gene such that input[0:3] is the start codon. The last 3 dna.Base of the input is not required to be a stop codon. Trailing sequence after the stop codon (i.e. the 3' UTR) may be optionally added to the input sequence, however the deletion position must be within the coding sequence. This trailing sequence is used when a variant causes a frameshift and a new stop codon in not found prior to the original stop codon. In this case the translation will continue into the 3' UTR attempting to find a new stop codon.
The offset integer input for the Effect method is added to the position in the receiver type and may be positive or negative. Often this offset will be the negative genomic position of the beginning of the start codon.
Effector is satisfied by Substitution, Insertion, Deletion, and Delins. The effects of Structural variation are often too complex to be described by CodingChange and therefore should be handled separately.
type Insertion ¶
Insertion describes an insertion into a sequence. Pos is the 0-base position of the base after the insertion. (e.g. ATG ins 1 C -> ACTG).
func (Insertion) Effect ¶
func (i Insertion) Effect(codingSeq []dna.Base, offsetStart int, offsetEnd int) (CodingChange, error)
Effect for Insertion determines a coding change resulting from an insertion.
func (Insertion) Mutate ¶
Mutate for Insertion attempts to make the insertion directly in the input sequence. If the input []dna.Base does not have the capacity to store the inserted bases, a new slice is allocated to store the input sequence and insertion. Note that this may change the input sequence, even if the return slice is saved to a different variable.
type Mutator ¶
type Mutator interface {
Mutate(seq []dna.Base, offsetStart int, offsetEnd int) ([]dna.Base, error)
}
Mutator is satisfied by types that implement the Mutate method, which alters an input []dna.Base per coordinates and sequence stored in the receiver type. The offsetStart/End integer inputs for the Mutate method are added to the start position and end position of the receiver type and may be positive or negative. Receiver types that only have one position (e.g. Substitution and Insertion) will only use the offsetStart value. The offset input is useful for cases where only a subset of the origin chromosome is available, operating on spliced sequences, or when making multiple insertions/deletions to the sequence.
The Mutate method does not guarantee that the input sequence remains unchanged. The return of the Mutate method should be stored in the input variable. e.g. sequence := Insertion.Mutate(sequence, 0)
Mutator is satisfied by Substitution, Insertion, Deletion, and Delins. Structural variation is often too complex to implement the simple Mutate method, therefore changing sequences per a structural variant should be done with a separate function. // TODO make this function and update godoc.
type Structural ¶
type Structural struct { }
TODO break into multiple types??? Structural is a catch-all for large variants including complex rearrangements, large insertions/deletions, and transposition of mobile elements.
type Substitution ¶
Substitution describes a single base change. Pos is the 0-base position of the changed base. (e.g. ATG sub 1 T>C -> ACG).
func (Substitution) Effect ¶
func (s Substitution) Effect(codingSeq []dna.Base, offsetStart int, offsetEnd int) (CodingChange, error)
Effect for Substitution determines a coding change resulting from a substitution.