Exemple #1
0
func (s *S) TestReadFasta(c *check.C) {
	if r, err := fasta.NewReaderName(fa); err != nil {
		c.Fatalf("Failed to open %q: %s", fa, err)
	} else {
		if a, err := NewReader(r).Read(); err != nil {
			c.Fatalf("Failed to read %q: %s", fa, err)
		} else {
			c.Check(len(a), check.Equals, 11)
		}
	}
}
Exemple #2
0
func BenchmarkAlign(b *testing.B) {
	b.StopTimer()
	if r, err := fasta.NewReaderName("../testdata/crsp.fa"); err != nil {
		return
	} else {
		swsa, _ := r.Read()
		swsb, _ := r.Read()

		swm := [][]int{
			{2, -1, -1, -1, -1},
			{-1, 2, -1, -1, -1},
			{-1, -1, 2, -1, -1},
			{-1, -1, -1, 2, -1},
			{-1, -1, -1, -1, 0},
		}

		smith := &Aligner{Matrix: swm, LookUp: LookUpN, GapChar: '-'}
		b.StartTimer()
		for i := 0; i < b.N; i++ {
			smith.Align(swsa, swsb)
		}
	}
}
Exemple #3
0
func BenchmarkAlign(b *testing.B) {
	b.StopTimer()
	if r, err := fasta.NewReaderName("../testdata/crsp.fa"); err != nil {
		return
	} else {
		nwsa, _ := r.Read()
		nwsb, _ := r.Read()

		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: '-'}
		b.StartTimer()
		for i := 0; i < b.N; i++ {
			needle.Align(nwsa, nwsb)
		}
	}
}