Documentation ¶
Overview ¶
Example (ScoreSeqs) ¶
package main import ( "fmt" "github.com/andrew-torda/goutil/gotoh" "github.com/andrew-torda/goutil/submat" ) func main() { seqs := []string{"acdefgacdefg", "cdefgacsfg", "cdefgactg", "cdefgacwg"} pnltys := gotoh.Pnlty{Open: 2, Wdn: 2} substMat, err := submat.Read("blosum62.txt") if err != nil { fmt.Print(err) } al_details := gotoh.Al_score{ Pnlty: pnltys, Al_type: gotoh.Local, } for i, s := range seqs { for j := i + 1; j < len(seqs); j++ { t := seqs[j] scr_mat := substMat.ScoreSeqs([]byte(s), []byte(t)) pairlist, a_scr := gotoh.Align(scr_mat, &al_details) gotoh.PrintSeqDebug(true, pairlist, []byte(s), []byte(t), gotoh.Global) fmt.Println("score", a_scr) } } }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmmtScanner ¶
CmmtScanner is a wrapper around bufio.Scanner that will ignore anything after a comment character and remove leading and trailing white space.
func NewCmmtScanner ¶
func NewCmmtScanner(r io.Reader, cmmt byte) *CmmtScanner
NewCmmtScanner is a wrapper around scanner, but
- jumps over blank lines
- removes leading spaces
- removes anything after a comment character
func (*CmmtScanner) CBytes ¶
func (s *CmmtScanner) CBytes() []byte
CBytes presents exactly the same interface as scanner.Bytes, but has to do a bit more work. Before returning, we remove anything after the comment symbol and strip leading and trailing white space. If this leaves us with an empty string, we call Scan again. Like the Bytes function, this works directly in the i/o buffer and does not allocate any memory. If you like the string it returns, you have to save it somewhere.
type Submat ¶
type Submat struct {
// contains filtered or unexported fields
}
Submat is the export type. it internals do not have to be exported.
func Read ¶
Read will read a substitution matrix from a filename. Return a pointer to a Submat structure.
func (*Submat) Score ¶
Score returns the similarity score of bytes a and b, given a specific scoring matrix.