10 type tilelibSuite struct {
15 var _ = check.Suite(&tilelibSuite{})
17 func (s *tilelibSuite) SetUpSuite(c *check.C) {
19 ggagaactgtgctccgccttcaga
20 acacatgctagcgcgtcggggtgg
21 gactctagcagagtggccagccac
22 cctcccgagccgagccacccgtca
23 gttattaataataacttatcatca
25 err := s.taglib.Load(bytes.NewBufferString(fasta))
26 c.Assert(err, check.IsNil)
27 for _, seq := range strings.Split(fasta, "\n") {
28 if len(seq) > 0 && seq[0] != '>' {
29 s.tag = append(s.tag, seq+"\n")
34 func (s *tilelibSuite) TestSkipOOO(c *check.C) {
35 // tags appear in seq: 4, 0, 2 (but skipOOO is false)
36 tilelib := &tileLibrary{taglib: &s.taglib, skipOOO: false}
37 tseq, err := tilelib.TileFasta("test-label", bytes.NewBufferString(">test-seq\n"+
39 "ggggggggggggggggggggggg\n"+
41 "cccccccccccccccccccc\n"+
44 c.Assert(err, check.IsNil)
45 c.Check(tseq, check.DeepEquals, tileSeq{"test-seq": []tileLibRef{{4, 1}, {0, 1}, {2, 1}}})
47 // tags appear in seq: 0, 1, 2 -> don't skip
48 tilelib = &tileLibrary{taglib: &s.taglib, skipOOO: true}
49 tseq, err = tilelib.TileFasta("test-label", bytes.NewBufferString(">test-seq\n"+
51 "cccccccccccccccccccc\n"+
53 "ggggggggggggggggggggggg\n"+
56 c.Assert(err, check.IsNil)
57 c.Check(tseq, check.DeepEquals, tileSeq{"test-seq": []tileLibRef{{0, 1}, {1, 1}, {2, 1}}})
59 // tags appear in seq: 2, 3, 4 -> don't skip
60 tilelib = &tileLibrary{taglib: &s.taglib, skipOOO: true}
61 tseq, err = tilelib.TileFasta("test-label", bytes.NewBufferString(">test-seq\n"+
63 "cccccccccccccccccccc\n"+
65 "ggggggggggggggggggggggg\n"+
68 c.Assert(err, check.IsNil)
69 c.Check(tseq, check.DeepEquals, tileSeq{"test-seq": []tileLibRef{{2, 1}, {3, 1}, {4, 1}}})
71 // tags appear in seq: 4, 0, 2 -> skip 4
72 tilelib = &tileLibrary{taglib: &s.taglib, skipOOO: true}
73 tseq, err = tilelib.TileFasta("test-label", bytes.NewBufferString(">test-seq\n"+
75 "cccccccccccccccccccc\n"+
77 "ggggggggggggggggggggggg\n"+
80 c.Assert(err, check.IsNil)
81 c.Check(tseq, check.DeepEquals, tileSeq{"test-seq": []tileLibRef{{0, 1}, {2, 1}}})
83 // tags appear in seq: 0, 2, 1 -> skip 2
84 tilelib = &tileLibrary{taglib: &s.taglib, skipOOO: true}
85 tseq, err = tilelib.TileFasta("test-label", bytes.NewBufferString(">test-seq\n"+
87 "cccccccccccccccccccc\n"+
89 "ggggggggggggggggggggggg\n"+
92 c.Assert(err, check.IsNil)
93 c.Check(tseq, check.DeepEquals, tileSeq{"test-seq": []tileLibRef{{0, 1}, {1, 1}}})
95 // tags appear in seq: 0, 1, 1, 2 -> skip second tag1
96 tilelib = &tileLibrary{taglib: &s.taglib, skipOOO: true}
97 tseq, err = tilelib.TileFasta("test-label", bytes.NewBufferString(">test-seq\n"+
99 "cccccccccccccccccccc\n"+
101 "ggggggggggggggggggggggg\n"+
103 "ggggggggggggggggggggggg\n"+
106 c.Assert(err, check.IsNil)
107 c.Check(tseq, check.DeepEquals, tileSeq{"test-seq": []tileLibRef{{0, 1}, {1, 1}, {2, 1}}})
109 // tags appear in seq: 0, 1, 3, 0, 4 -> skip second tag0
110 tilelib = &tileLibrary{taglib: &s.taglib, skipOOO: true}
111 tseq, err = tilelib.TileFasta("test-label", bytes.NewBufferString(">test-seq\n"+
113 "cccccccccccccccccccc\n"+
115 "ggggggggggggggggggggggg\n"+
117 "ggggggggggggggggggggggg\n"+
119 "ggggggggggggggggggggggg\n"+
122 c.Assert(err, check.IsNil)
123 c.Check(tseq, check.DeepEquals, tileSeq{"test-seq": []tileLibRef{{0, 1}, {1, 1}, {3, 1}, {4, 1}}})
125 // tags appear in seq: 0, 1, 3 -> don't skip
126 tilelib = &tileLibrary{taglib: &s.taglib, skipOOO: true}
127 tseq, err = tilelib.TileFasta("test-label", bytes.NewBufferString(">test-seq\n"+
129 "cccccccccccccccccccc\n"+
131 "ggggggggggggggggggggggg\n"+
134 c.Assert(err, check.IsNil)
135 c.Check(tseq, check.DeepEquals, tileSeq{"test-seq": []tileLibRef{{0, 1}, {1, 1}, {3, 1}}})