Documentation
¶
Overview ¶
Needleman-Wunsch sequence alignment package
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var LookUpN, LookUpR, LookUpP util.CTL
Default character table lookups.
Functions ¶
This section is empty.
Types ¶
type Aligner ¶
Needleman-Wunsch aligner type. Matrix is a square scoring matrix with the last column and last row specifying gap penalties. GapChar is the character used to fill gaps. LookUp is used to translate sequance values into positions in the scoring matrix. Currently gap opening is not considered.
func (*Aligner) Align ¶
Method to align two sequences using the Smith-Waterman algorithm. Returns an alignment or an error if the scoring matrix is not square.
Example ¶
nwsa := &seq.Seq{Seq: []byte("AGACTAGTTA")}
nwsb := &seq.Seq{Seq: []byte("GACAGACG")}
// A C G T -
// A 10 -3 -1 -4 -5
// C -3 9 -5 0 -5
// G -1 -5 7 -3 -5
// T -4 0 -3 8 -5
// - -5 -5 -5 -5 0
nwm := [][]int{
{10, -3, -1, -4, -5},
{-3, 9, -5, 0, -5},
{-1, -5, 7, -3, -5},
{-4, 0, -3, 8, -5},
{-4, -4, -4, -4, 0},
}
needle := &Aligner{Matrix: nwm, LookUp: LookUpN, GapChar: '-'}
if nwa, err := needle.Align(nwsa, nwsb); err == nil {
fmt.Printf("%s\n%s\n", nwa[0].Seq, nwa[1].Seq)
}
Output: AGACTAGTTA -GAC-AGACG
Click to show internal directories.
Click to hide internal directories.