Documentation
¶
Overview ¶
Package sequtil provides functions for processing genetic sequences.
Data Type For Sequences ¶
In this repository, sequences are represented as byte slices. This is meant to keep them familiar and predictable. This design favors having a buffet of functions for manipulating basic types, over having a dedicated sequence type with methods.
Mutating Sequences ¶
Mutations can be made using basic slice operations.
// Substitution seq[4] = 'G' // Deletion of bases 10-12 (including 12) copy(seq[10:], seq[13:]) seq = seq[:len(seq)-3] // Insertion at position 4 insert := []byte{...} seq = append(append(append([]byte{}, seq[:4]...), insert...), seq[4:]...)
The U Nucleotide ¶
This package currently ignores the existence of uracil. Adding support for uracil means increasing the complexity of the API without adding new capabilities. The current solution is to substitute U's with T's before calling this package.
This may change in the future, keeping backward compatibility.
Index ¶
- Constants
- func AminoName(aa byte) (string, string)
- func DNAFrom2Bit(dst, src []byte) []byte
- func DNATo2Bit(dst, src []byte) []byte
- func Iton(num int) byte
- func Ntoi(nuc byte) int
- func ReverseComplement(dst, src []byte) []byte
- func ReverseComplementString(s string) string
- func Translate(dst, src []byte) []byte
- func TranslateReadingFrames(seq []byte) [3][]byte
Constants ¶
const ( // AminoAcids holds the single-letter amino acid symbols. // These are the valid inputs to AminoName. AminoAcids = "ABCDEFGHIKLMNPQRSTVWXYZ*" )
Variables ¶
This section is empty.
Functions ¶
func AminoName ¶ added in v0.1.10
AminoName returns the 3-letter code and the full name of the amino acid with the given letter. Input may be uppercase or lowercase.
func DNAFrom2Bit ¶
DNAFrom2Bit appends to dst the nucleotides represented in 2-bit in src and returns the new dst. Only outputs characters in "ACGT".
func DNATo2Bit ¶
DNATo2Bit appends to dst the 2-bit representation of the DNA sequence in src, and returns the new dst. Characters not in "aAcCgGtT" will cause a panic.
func ReverseComplement ¶
ReverseComplement appends to dst the reverse complement of src and returns the new dst. Characters not in "aAcCgGtTnN" will cause a panic.
func ReverseComplementString ¶
ReverseComplementString returns the reverse complement of s. Characters not in "aAcCgGtTnN" will cause a panic.
func Translate ¶ added in v0.1.10
Translate translates the nucleotides in src to amino acids, appends the result to dst and returns the new slice. Nucleotides should be in "aAcCgGtT". Length of src should be a multiple of 3.
func TranslateReadingFrames ¶ added in v0.1.10
TranslateReadingFrames returns the translation of the 3 reading frames of seq. Nucleotides should be in "aAcCgGtT". seq can be of any length.
Types ¶
This section is empty.