Documentation ¶
Overview ¶
Package sequtils provides generic functions for manipulation of biogo/seq/... types.
Index ¶
- func Compose(dst, src Sliceable, fs feat.Set) error
- func Join(dst, src Joinable, where int) error
- func Stitch(dst, src Sliceable, fs feat.Set) error
- func Trim(q QualityFeature, limit float64) (start, end int)
- func Truncate(dst, src Sliceable, start, end int) error
- type Joinable
- type QualityFeature
- type SliceReverser
- type Sliceable
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compose ¶
Compose produces a composition of src defined by the features in fs. The subparts of the composition may be out of order and if features in fs specify orientation may be reversed or reverse complemented depending on the src - if src is a SliceReverser and its alphabet is a Complementor the segment will be reverse complemented, if the alphabte is not a Complementor these segments will only be reversed. If src is not a SliceREverser and a reverse segment is specified an error is returned. Composing a circular sequence returns a linear sequence.
func Join ¶
Join joins a and be with the target location of b specified by where. The offset of dst will be updated if src is prepended. Join will panic if dst and src do not hold the same concrete Slice type. Circular sequences cannot be joined.
Example ¶
var s1, s2 *offSlice s1 = stringToOffSlice("agctgtgctga") s2 = stringToOffSlice("CGTGCAGTCATGAGTGA") fmt.Printf("%s %s\n", s1, s2) Join(s1, s2, seq.Start) fmt.Printf("%s\n", s1) s1 = stringToOffSlice("agctgtgctga") s2 = stringToOffSlice("CGTGCAGTCATGAGTGA") Join(s1, s2, seq.End) fmt.Printf("%s\n", s1)
Output: agctgtgctga 0 CGTGCAGTCATGAGTGA 0 CGTGCAGTCATGAGTGAagctgtgctga -17 agctgtgctgaCGTGCAGTCATGAGTGA 0
func Stitch ¶
Stitch produces a subsequence of src defined by fs and places the the result in dst. The subsequences are guaranteed to be in order and non-overlapping even if not provided as such. Stitching a circular sequence returns a linear sequence.
Example ¶
s := stringToConformRangeOffSlice("aAGTATAAgtcagtgcagtgtctggcagTGCTCGTGCgtagtgaagtagGGTTAGTTTa") f := fs{ fe{s: 1, e: 8}, fe{s: 28, e: 37}, fe{s: 49, e: len(s.slice) - 1}, } fmt.Printf("%s\n", s) if err := Stitch(s, s, f); err == nil { fmt.Printf("%s\n", s) }
Output: aAGTATAAgtcagtgcagtgtctggcagTGCTCGTGCgtagtgaagtagGGTTAGTTTa AGTATAATGCTCGTGCGGTTAGTTT
func Trim ¶
func Trim(q QualityFeature, limit float64) (start, end int)
Trim uses the modified-Mott trimming function to determine the start and end positions of good sequence. http://www.phrap.org/phredphrap/phred.html
func Truncate ¶
Truncate performs a truncation on src from start to end and places the result in dst. The conformation of dst is set to linear and the offset is set to start. If dst and src are not equal, a copy of the truncation is allocated. Only circular sequences can be truncated with start > end.
Example (A) ¶
s := stringToConformRangeOffSlice("ACGCTGACTTGGTGCACGT") s.conf = feat.Linear fmt.Printf("%s\n", s) if err := Truncate(s, s, 5, 12); err == nil { fmt.Printf("%s\n", s) }
Output: ACGCTGACTTGGTGCACGT GACTTGG
Example (B) ¶
var ( src = stringToConformRangeOffSlice("ACGCTGACTTGGTGCACGT") dst = &conformRangeOffSlice{} ) src.conf = feat.Circular fmt.Printf("%s Conformation = %v\n", src, src.Conformation()) if err := Truncate(dst, src, 12, 5); err == nil { fmt.Printf("%s\n", dst) } else { fmt.Println("Error:", err) } src.conf = feat.Linear fmt.Printf("%s Conformation = %v\n", src, src.Conformation()) if err := Truncate(dst, src, 12, 5); err == nil { fmt.Printf("%s\n", dst) } else { fmt.Println("Error:", err) }
Output: ACGCTGACTTGGTGCACGT Conformation = circular TGCACGTACGCT ACGCTGACTTGGTGCACGT Conformation = linear Error: sequtils: start position greater than end position for linear sequence
Types ¶
type Joinable ¶
A Joinable can be joined to another of the same concrete type using the Join function.
type QualityFeature ¶
A QualityFeature describes a segment of sequence quality information. EAt() called with column values within Start() and End() is expected to return valid error probabilities for the zero'th row position.