github.com/biogo/biogo@v1.0.4/io/seqio/alignio/alignio_test.go (about)

     1  // Copyright ©2011-2012 The bíogo Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package alignio
     6  
     7  import (
     8  	"github.com/biogo/biogo/alphabet"
     9  	"github.com/biogo/biogo/io/seqio/fasta"
    10  	"github.com/biogo/biogo/io/seqio/fastq"
    11  	"github.com/biogo/biogo/seq"
    12  	"github.com/biogo/biogo/seq/linear"
    13  	"github.com/biogo/biogo/seq/multi"
    14  
    15  	"strings"
    16  	"testing"
    17  
    18  	"gopkg.in/check.v1"
    19  )
    20  
    21  // Tests
    22  func Test(t *testing.T) { check.TestingT(t) }
    23  
    24  type S struct{}
    25  
    26  var _ = check.Suite(&S{})
    27  
    28  func (s *S) TestReadFasta(c *check.C) {
    29  	r := fasta.NewReader(strings.NewReader(fa), linear.NewSeq("", nil, alphabet.Protein))
    30  	m, _ := multi.NewMulti("", nil, seq.DefaultConsensus)
    31  	a, err := NewReader(r, m).Read()
    32  	c.Check(err, check.Equals, nil)
    33  	c.Check(a.Rows(), check.Equals, 11)
    34  }
    35  
    36  func (s *S) TestReadFastq(c *check.C) {
    37  	r := fastq.NewReader(strings.NewReader(fq), linear.NewQSeq("", nil, alphabet.DNA, alphabet.Sanger))
    38  	m, _ := multi.NewMulti("", nil, seq.DefaultQConsensus)
    39  	a, err := NewReader(r, m).Read()
    40  	c.Check(err, check.Equals, nil)
    41  	c.Check(a.Rows(), check.Equals, 25)
    42  }