-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathillumina_test.go
130 lines (117 loc) · 3.19 KB
/
illumina_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// Copyright ©2013 The bíogo Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package illumina
import (
"testing"
"github.com/biogo/biogo/alphabet"
"github.com/biogo/biogo/feat"
"gopkg.in/check.v1"
)
func Test(t *testing.T) { check.TestingT(t) }
type S struct{}
var _ = check.Suite(&S{})
type tester struct {
name string
desc string
}
func (t tester) Name() string { return t.name }
func (t tester) Description() string { return t.desc }
type alphaTester struct {
name string
desc string
alpha alphabet.Alphabet
}
func (t alphaTester) Name() string { return t.name }
func (t alphaTester) Description() string { return t.desc }
func (t alphaTester) Alphabet() alphabet.Alphabet { return t.alpha }
var underscored = alphabet.MustComplement(alphabet.NewComplementor(
"acgt_",
feat.DNA,
alphabet.MustPair(alphabet.NewPairing("acgtnxACGTNX-_", "tgcanxTGCANX-_")),
'-', 'n',
!alphabet.CaseSensitive,
))
func (s *S) TestParse(c *check.C) {
for i, t := range []struct {
in Interface
meta Metadata
}{
{
tester{"HWUSI-EAS100R:6:73:941:1973#0/1", ""},
Metadata{
Type: PreCasava,
Instrument: "HWUSI-EAS100R",
Run: -1, // Pre-Casava
Lane: 6,
Tile: 73,
Coordinate: Coordinate{941, 1973},
Mate: 1,
Multiplex: Multiplex{Index: 0},
},
},
{
tester{"HWUSI-EAS100R:6:73:941:1973#ATCACG/1", ""},
Metadata{
Type: PreCasava,
Instrument: "HWUSI-EAS100R",
Run: -1, // Pre-Casava
Lane: 6,
Tile: 73,
Coordinate: Coordinate{941, 1973},
Mate: 1,
Multiplex: Multiplex{Index: -1, Tag: "ATCACG"},
},
},
{
tester{"EAS139:136:FC706VJ:2:2104:15343:197393", "1:Y:18:ATCACG"},
Metadata{
Type: Casava,
Instrument: "EAS139",
Run: 136,
FlowCell: "FC706VJ",
Lane: 2,
Tile: 2104,
Coordinate: Coordinate{15343, 197393},
Mate: 1,
BadRead: true,
ControlBits: 18,
Multiplex: Multiplex{Index: -1, Tag: "ATCACG"},
},
},
{ // This test is for sequences that have passed through a pipeline that strips desc fields.
tester{"EAS139:136:FC706VJ:2:2104:15343:197393", ""},
Metadata{
Type: Casava,
Instrument: "EAS139",
Run: 136,
FlowCell: "FC706VJ",
Lane: 2,
Tile: 2104,
Coordinate: Coordinate{15343, 197393},
Mate: 0,
BadRead: false,
ControlBits: -1,
Multiplex: Multiplex{Index: -1},
},
},
{ // This test is for tags where unusual tag characters have been used.
alphaTester{"FCC4T93ACXX:2:1101:1899:1998#ATTACTCG_GGCTCTGA/2", "", underscored},
Metadata{
Type: PreCasava,
Instrument: "FCC4T93ACXX",
Run: -1,
Lane: 2,
Tile: 1101,
Coordinate: Coordinate{1899, 1998},
Mate: 2,
BadRead: false,
Multiplex: Multiplex{Index: -1, Tag: "ATTACTCG_GGCTCTGA"},
},
},
} {
m, err := Parse(t.in)
c.Check(err, check.Equals, nil, check.Commentf("Test %d", i))
c.Check(m, check.Equals, t.meta, check.Commentf("Test %d", i))
}
}