bio-vcf 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +8 -0
- data/README.md +376 -11
- data/VERSION +1 -1
- data/bin/bio-vcf +172 -39
- data/bio-vcf.gemspec +18 -3
- data/features/cli.feature +32 -0
- data/features/multisample.feature +28 -10
- data/features/step_definitions/cli-feature.rb +12 -0
- data/features/step_definitions/multisample.rb +64 -18
- data/features/support/env.rb +5 -0
- data/lib/bio-vcf.rb +2 -0
- data/lib/bio-vcf/utils.rb +23 -0
- data/lib/bio-vcf/vcfgenotypefield.rb +73 -28
- data/lib/bio-vcf/vcfheader.rb +8 -0
- data/lib/bio-vcf/vcfline.rb +1 -0
- data/lib/bio-vcf/vcfrecord.rb +142 -14
- data/lib/bio-vcf/vcfsample.rb +88 -0
- data/test/data/input/dbsnp.vcf +200 -0
- data/test/data/input/multisample.vcf +2 -2
- data/test/data/regression/eval_r.info.dp.ref +150 -0
- data/test/data/regression/r.info.dp.ref +147 -0
- data/test/data/regression/rewrite.info.sample.ref +150 -0
- data/test/data/regression/s.dp.ref +145 -0
- data/test/data/regression/seval_s.dp.ref +36 -0
- data/test/data/regression/sfilter001.ref +145 -0
- data/test/performance/metrics.md +98 -0
- metadata +28 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/bin/bio-vcf
CHANGED
@@ -27,9 +27,34 @@ options = { show_help: false}
|
|
27
27
|
opts = OptionParser.new do |o|
|
28
28
|
o.banner = "Usage: #{File.basename($0)} [options] filename\ne.g. #{File.basename($0)} < test/data/input/somaticsniper.vcf"
|
29
29
|
|
30
|
+
o.on('-i','--ignore-missing', 'Ignore missing data') do
|
31
|
+
options[:ignore_missing] = true
|
32
|
+
end
|
30
33
|
o.on('--filter cmd',String, 'Evaluate filter on each record') do |cmd|
|
31
34
|
options[:filter] = cmd
|
32
35
|
end
|
36
|
+
|
37
|
+
o.on('--sfilter cmd',String, 'Evaluate filter on each sample') do |cmd|
|
38
|
+
options[:sfilter] = cmd
|
39
|
+
end
|
40
|
+
o.on("--sfilter-samples list", Array, "Filter on selected samples") do |l|
|
41
|
+
options[:sfilter_samples] = l
|
42
|
+
end
|
43
|
+
|
44
|
+
o.on('--ifilter cmd','--if cmd',String, 'Include filter') do |cmd|
|
45
|
+
options[:ifilter] = cmd
|
46
|
+
end
|
47
|
+
o.on("--ifilter-samples list", Array, "Include set - implicitely defines exclude set") do |l|
|
48
|
+
options[:ifilter_samples] = l
|
49
|
+
end
|
50
|
+
|
51
|
+
o.on('--efilter cmd','--ef cmd',String, 'Exclude filter') do |cmd|
|
52
|
+
options[:efilter] = cmd
|
53
|
+
end
|
54
|
+
o.on("--efilter-samples list", Array, "Exclude set - overrides exclude set") do |l|
|
55
|
+
options[:efilter_samples] = l
|
56
|
+
end
|
57
|
+
|
33
58
|
o.on('-e cmd', '--eval cmd',String, 'Evaluate command on each record') do |cmd|
|
34
59
|
options[:eval] = cmd
|
35
60
|
end
|
@@ -37,9 +62,20 @@ opts = OptionParser.new do |o|
|
|
37
62
|
options[:eval_once] = true
|
38
63
|
options[:eval] = cmd
|
39
64
|
end
|
65
|
+
o.on('--seval cmd',String, 'Evaluate command on each sample') do |cmd|
|
66
|
+
options[:seval] = cmd
|
67
|
+
options[:skip_header] = true
|
68
|
+
end
|
69
|
+
o.on("--rewrite eval", "Rewrite INFO") do |s|
|
70
|
+
options[:rewrite] = s
|
71
|
+
end
|
72
|
+
o.on("--samples list", Array, "Output selected samples") do |l|
|
73
|
+
options[:samples] = l
|
74
|
+
end
|
40
75
|
o.on("--rdf", "Generate Turtle RDF") do |b|
|
41
76
|
require 'bio-vcf/vcfrdf'
|
42
77
|
options[:rdf] = true
|
78
|
+
options[:skip_header] = true
|
43
79
|
end
|
44
80
|
o.on_tail("--id name", String, "Identifier") do |s|
|
45
81
|
options[:id] = s
|
@@ -62,11 +98,11 @@ opts = OptionParser.new do |o|
|
|
62
98
|
# Bio::Log::CLI.trace('error')
|
63
99
|
options[:quiet] = true
|
64
100
|
end
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
101
|
+
|
102
|
+
o.on("-v", "--verbose", "Run verbosely") do |v|
|
103
|
+
options[:verbose] = true
|
104
|
+
end
|
105
|
+
|
70
106
|
# o.on("--debug", "Show debug messages") do |v|
|
71
107
|
# Bio::Log::CLI.trace('debug')
|
72
108
|
# end
|
@@ -77,61 +113,158 @@ opts = OptionParser.new do |o|
|
|
77
113
|
end
|
78
114
|
end
|
79
115
|
|
80
|
-
include BioVcf
|
81
116
|
|
82
|
-
|
83
|
-
|
117
|
+
def parse_line line,header,options,samples
|
118
|
+
# fields = VcfLine.parse(line,header.columns)
|
119
|
+
fields = VcfLine.parse(line)
|
120
|
+
rec = VcfRecord.new(fields,header)
|
121
|
+
r = rec # alias
|
84
122
|
|
85
|
-
|
123
|
+
filter = options[:filter]
|
124
|
+
sfilter = options[:sfilter]
|
125
|
+
efilter = options[:efilter]
|
126
|
+
ifilter = options[:ifilter]
|
127
|
+
ignore_missing = options[:ignore_missing]
|
128
|
+
quiet = options[:quiet]
|
129
|
+
# --------------------------
|
130
|
+
# Filtering and set analysis
|
131
|
+
return if filter and not rec.eval(filter,ignore_missing,quiet)
|
132
|
+
|
133
|
+
if sfilter
|
134
|
+
rec.each_sample(options[:sfilter_samples]) do | sample |
|
135
|
+
return if not sample.eval(sfilter,ignore_missing,quiet)
|
136
|
+
end
|
137
|
+
end
|
86
138
|
|
87
|
-
if
|
88
|
-
|
89
|
-
|
90
|
-
|
139
|
+
if ifilter
|
140
|
+
rec.each_sample(options[:ifilter_samples]) do | sample |
|
141
|
+
return if not sample.eval(ifilter,ignore_missing,quiet)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
if efilter
|
146
|
+
rec.each_sample(options[:efilter_samples]) do | sample |
|
147
|
+
return if not sample.eval(efilter,ignore_missing,quiet)
|
148
|
+
end
|
91
149
|
end
|
92
150
|
|
93
|
-
|
151
|
+
# -----------------------------
|
152
|
+
# From here on decide on output
|
153
|
+
if samples
|
154
|
+
# Select certain samples for output
|
155
|
+
newfields = fields[0..8]
|
156
|
+
samples.each do |s|
|
157
|
+
newfields << fields[s+9]
|
158
|
+
end
|
159
|
+
fields = newfields
|
160
|
+
end
|
161
|
+
if options[:eval] or options[:seval]
|
162
|
+
begin
|
163
|
+
results = nil # result string
|
164
|
+
if options[:eval]
|
165
|
+
res = rec.eval(options[:eval],ignore_missing,quiet)
|
166
|
+
results = res if res
|
167
|
+
end
|
168
|
+
if options[:seval]
|
169
|
+
list = (results ? [] : [rec.chr,rec.pos])
|
170
|
+
rec.each_sample(options[:sfilter_samples]) { | sample |
|
171
|
+
list << sample.eval(options[:seval],ignore_missing,quiet)
|
172
|
+
}
|
173
|
+
results = (results ? results + "\t" : "" ) + list.join("\t")
|
174
|
+
end
|
175
|
+
rescue => e
|
176
|
+
$stderr.print "\nLine: ",line
|
177
|
+
$stderr.print "ERROR evaluating --eval <#{options[:eval]}> #{e.message}\n"
|
178
|
+
raise if options[:verbose]
|
179
|
+
exit 1
|
180
|
+
end
|
181
|
+
print results,"\n" if results
|
182
|
+
exit(1) if options[:eval_once]
|
183
|
+
else
|
184
|
+
if options[:rdf]
|
185
|
+
# Output Turtle RDF
|
186
|
+
if not header_out
|
187
|
+
VcfRdf::header
|
188
|
+
header_out = true
|
189
|
+
end
|
190
|
+
VcfRdf::record(options[:id],rec,options[:tags])
|
191
|
+
elsif options[:rewrite]
|
192
|
+
# Default behaviour prints VCF line, but rewrite info
|
193
|
+
eval(options[:rewrite])
|
194
|
+
print (fields[0..6]+[rec.info.to_s]+fields[8..-1]).join("\t"),"\n"
|
195
|
+
else
|
196
|
+
# Default behaviour prints VCF line
|
197
|
+
print fields.join("\t"),"\n"
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
include BioVcf
|
203
|
+
|
204
|
+
opts.parse!(ARGV)
|
94
205
|
|
95
|
-
|
96
|
-
header_out = false
|
206
|
+
$stderr.print "vcf #{version} (biogem Ruby #{RUBY_VERSION}) by Pjotr Prins 2014\n" if !options[:quiet]
|
97
207
|
|
98
|
-
|
208
|
+
if options[:show_help]
|
209
|
+
print opts
|
210
|
+
print USAGE
|
211
|
+
exit 1
|
212
|
+
end
|
213
|
+
|
214
|
+
$stderr.print "Options: ",options,"\n" if !options[:quiet]
|
215
|
+
|
216
|
+
if options[:samples]
|
217
|
+
samples = options[:samples].map { |s| s.to_i }
|
218
|
+
end
|
219
|
+
header = VcfHeader.new
|
220
|
+
header_out = false
|
221
|
+
line_number=0
|
222
|
+
|
223
|
+
STDIN.each_line do | line |
|
224
|
+
line_number += 1
|
225
|
+
$stderr.print '.' if line_number%100_000 == 0 and not options[:quiet]
|
226
|
+
begin
|
99
227
|
if line =~ /^##fileformat=/
|
100
228
|
# ---- We have a new file header
|
101
229
|
header = VcfHeader.new
|
102
230
|
header.add(line)
|
231
|
+
print line if not options[:skip_header]
|
103
232
|
STDIN.each_line do | headerline |
|
104
233
|
if headerline !~ /^#/
|
105
234
|
line = headerline
|
106
235
|
break # end of header
|
107
236
|
end
|
108
237
|
header.add(headerline)
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
VcfRdf::header
|
124
|
-
header_out = true
|
238
|
+
if not options[:skip_header]
|
239
|
+
if headerline =~ /^#CHR/
|
240
|
+
selected = header.column_names
|
241
|
+
if samples
|
242
|
+
newfields = selected[0..8]
|
243
|
+
samples.each do |s|
|
244
|
+
newfields << selected[s+9]
|
245
|
+
end
|
246
|
+
selected = newfields
|
247
|
+
end
|
248
|
+
|
249
|
+
print "#",selected.join("\t"),"\n"
|
250
|
+
else
|
251
|
+
print headerline
|
125
252
|
end
|
126
|
-
VcfRdf::record(options[:id],rec,options[:tags])
|
127
|
-
else
|
128
|
-
# Default behaviour prints VCF line
|
129
|
-
print fields.join("\t")
|
130
253
|
end
|
131
254
|
end
|
132
|
-
print "\n"
|
133
255
|
end
|
256
|
+
next if line =~ /^##/ # empty file
|
257
|
+
if not options[:efilter_samples] and options[:ifilter_samples]
|
258
|
+
# Create exclude set as a complement of include set
|
259
|
+
options[:efilter_samples] = header.column_names[9..-1].fill{|i|i.to_s}-options[:ifilter_samples]
|
260
|
+
end
|
261
|
+
# ---- Parse VCF record line
|
262
|
+
parse_line line,header,options,samples
|
263
|
+
rescue Exception => e
|
264
|
+
# $stderr.print line
|
265
|
+
$stderr.print e.message,"\n"
|
266
|
+
raise if options[:verbose]
|
267
|
+
exit 1
|
134
268
|
end
|
135
|
-
|
136
269
|
end
|
137
270
|
|
data/bio-vcf.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "bio-vcf"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Pjotr Prins"]
|
12
|
-
s.date = "2014-
|
12
|
+
s.date = "2014-05-24"
|
13
13
|
s.description = "Smart parser for VCF format"
|
14
14
|
s.email = "pjotr.public01@thebird.nl"
|
15
15
|
s.executables = ["bio-vcf"]
|
@@ -27,15 +27,18 @@ Gem::Specification.new do |s|
|
|
27
27
|
"VERSION",
|
28
28
|
"bin/bio-vcf",
|
29
29
|
"bio-vcf.gemspec",
|
30
|
+
"features/cli.feature",
|
30
31
|
"features/diff_count.feature",
|
31
32
|
"features/multisample.feature",
|
32
33
|
"features/somaticsniper.feature",
|
33
34
|
"features/step_definitions/bio-vcf_steps.rb",
|
35
|
+
"features/step_definitions/cli-feature.rb",
|
34
36
|
"features/step_definitions/diff_count.rb",
|
35
37
|
"features/step_definitions/multisample.rb",
|
36
38
|
"features/step_definitions/somaticsniper.rb",
|
37
39
|
"features/support/env.rb",
|
38
40
|
"lib/bio-vcf.rb",
|
41
|
+
"lib/bio-vcf/utils.rb",
|
39
42
|
"lib/bio-vcf/variant.rb",
|
40
43
|
"lib/bio-vcf/vcf.rb",
|
41
44
|
"lib/bio-vcf/vcfgenotypefield.rb",
|
@@ -43,8 +46,17 @@ Gem::Specification.new do |s|
|
|
43
46
|
"lib/bio-vcf/vcfline.rb",
|
44
47
|
"lib/bio-vcf/vcfrdf.rb",
|
45
48
|
"lib/bio-vcf/vcfrecord.rb",
|
49
|
+
"lib/bio-vcf/vcfsample.rb",
|
50
|
+
"test/data/input/dbsnp.vcf",
|
46
51
|
"test/data/input/multisample.vcf",
|
47
|
-
"test/data/input/somaticsniper.vcf"
|
52
|
+
"test/data/input/somaticsniper.vcf",
|
53
|
+
"test/data/regression/eval_r.info.dp.ref",
|
54
|
+
"test/data/regression/r.info.dp.ref",
|
55
|
+
"test/data/regression/rewrite.info.sample.ref",
|
56
|
+
"test/data/regression/s.dp.ref",
|
57
|
+
"test/data/regression/seval_s.dp.ref",
|
58
|
+
"test/data/regression/sfilter001.ref",
|
59
|
+
"test/performance/metrics.md"
|
48
60
|
]
|
49
61
|
s.homepage = "http://github.com/pjotrp/bioruby-vcf"
|
50
62
|
s.licenses = ["MIT"]
|
@@ -59,15 +71,18 @@ Gem::Specification.new do |s|
|
|
59
71
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
60
72
|
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
61
73
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
74
|
+
s.add_development_dependency(%q<regressiontest>, [">= 0"])
|
62
75
|
else
|
63
76
|
s.add_dependency(%q<rspec>, [">= 0"])
|
64
77
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
65
78
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
79
|
+
s.add_dependency(%q<regressiontest>, [">= 0"])
|
66
80
|
end
|
67
81
|
else
|
68
82
|
s.add_dependency(%q<rspec>, [">= 0"])
|
69
83
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
70
84
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
85
|
+
s.add_dependency(%q<regressiontest>, [">= 0"])
|
71
86
|
end
|
72
87
|
end
|
73
88
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
@cli
|
2
|
+
Feature: Command-line interface (CLI)
|
3
|
+
|
4
|
+
bio-vcf has a powerful command line interface. Here we regression test features.
|
5
|
+
|
6
|
+
Scenario: Test the info filter using dp
|
7
|
+
Given I have input file(s) named "test/data/input/multisample.vcf"
|
8
|
+
When I execute "./bin/bio-vcf -i --filter 'r.info.dp>100'"
|
9
|
+
Then I expect the named output to match the named output "r.info.dp"
|
10
|
+
|
11
|
+
Scenario: Test the sample filter using dp
|
12
|
+
Given I have input file(s) named "test/data/input/multisample.vcf"
|
13
|
+
When I execute "./bin/bio-vcf -i --sfilter 's.dp>20'"
|
14
|
+
Then I expect the named output to match the named output "s.dp"
|
15
|
+
|
16
|
+
Scenario: Test the info eval using dp
|
17
|
+
Given I have input file(s) named "test/data/input/multisample.vcf"
|
18
|
+
When I execute "./bin/bio-vcf -i --eval 'r.info.dp'"
|
19
|
+
Then I expect the named output to match the named output "eval_r.info.dp"
|
20
|
+
|
21
|
+
Scenario: Test the sample eval using dp
|
22
|
+
Given I have input file(s) named "test/data/input/multisample.vcf"
|
23
|
+
When I execute "./bin/bio-vcf -i --seval 's.dp'"
|
24
|
+
Then I expect the named output to match the named output "seval_s.dp"
|
25
|
+
|
26
|
+
Scenario: Rewrite an info field
|
27
|
+
Given I have input file(s) named "test/data/input/multisample.vcf"
|
28
|
+
When I execute "./bin/bio-vcf --rewrite rec.info[\'sample\']=\'XXXXX\'"
|
29
|
+
Then I expect the named output to match the named output "rewrite.info.sample"
|
30
|
+
|
31
|
+
|
32
|
+
|
@@ -8,7 +8,7 @@ Feature: Multi-sample VCF
|
|
8
8
|
|
9
9
|
Given the multi sample header line
|
10
10
|
"""
|
11
|
-
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT
|
11
|
+
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT Original s1t1 s2t1 s3t1 s1t2 s2t2 s3t2
|
12
12
|
"""
|
13
13
|
When I parse the header
|
14
14
|
Given multisample vcf line
|
@@ -16,6 +16,7 @@ Feature: Multi-sample VCF
|
|
16
16
|
1 10321 . C T 106.30 . AC=5;AF=0.357;AN=14;BaseQRankSum=3.045;DP=1537;Dels=0.01;FS=5.835;HaplotypeScore=220.1531;MLEAC=5;MLEAF=0.357;MQ=26.69;MQ0=258;MQRankSum=-4.870;QD=0.10;ReadPosRankSum=0.815 GT:AD:DP:GQ:PL 0/1:189,25:218:30:30,0,810 0/0:219,22:246:24:0,24,593 0/1:218,27:248:34:34,0,1134 0/0:220,22:248:56:0,56,1207 0/1:168,23:193:19:19,0,493 0/1:139,22:164:46:46,0,689 0/1:167,26:196:20:20,0,522
|
17
17
|
"""
|
18
18
|
When I parse the record
|
19
|
+
Then I expect rec.valid? to be true
|
19
20
|
Then I expect rec.chrom to contain "1"
|
20
21
|
Then I expect rec.pos to contain 10321
|
21
22
|
Then I expect rec.ref to contain "C"
|
@@ -25,13 +26,30 @@ Feature: Multi-sample VCF
|
|
25
26
|
And I expect rec.info.af to be 0.357
|
26
27
|
And I expect rec.info.dp to be 1537
|
27
28
|
And I expect rec.info.readposranksum to be 0.815
|
28
|
-
And I expect rec.sample['
|
29
|
-
And I expect rec.sample['
|
30
|
-
And I expect rec.sample['
|
31
|
-
And I expect rec.sample['
|
32
|
-
And I expect rec.sample['
|
33
|
-
And I expect rec.sample['
|
29
|
+
And I expect rec.sample['Original'].ad to be [189,25]
|
30
|
+
And I expect rec.sample['Original'].gt to be [0,1]
|
31
|
+
And I expect rec.sample['s3t2'].ad to be [167,26]
|
32
|
+
And I expect rec.sample['s3t2'].dp to be 196
|
33
|
+
And I expect rec.sample['s3t2'].gq to be 20
|
34
|
+
And I expect rec.sample['s3t2'].pl to be [20,0,522]
|
34
35
|
# And the nicer self resolving
|
35
|
-
And I expect rec.sample.
|
36
|
-
And I expect rec.sample.
|
37
|
-
|
36
|
+
And I expect rec.sample.original.gt to be [0,1]
|
37
|
+
And I expect rec.sample.s3t2.pl to be [20,0,522]
|
38
|
+
# And the even better
|
39
|
+
And I expect rec.original.gt to be [0,1]
|
40
|
+
And I expect rec.s3t2.pl to be [20,0,522]
|
41
|
+
# Check for missing data
|
42
|
+
And I expect test rec.missing_samples? to be false
|
43
|
+
And I expect test rec.original? to be true
|
44
|
+
Given multisample vcf line
|
45
|
+
"""
|
46
|
+
1 10723 . C G 73.85 . AC=4;AF=0.667;AN=6;BaseQRankSum=1.300;DP=18;Dels=0.00;FS=3.680;HaplotypeScore=0.0000;MLEAC=4;MLEAF=0.667;MQ=20.49;MQ0=11;MQRankSum=1.754;QD=8.21;ReadPosRankSum=0.000 GT:AD:DP:GQ:PL ./. ./. 1/1:2,2:4:6:66,6,0 1/1:4,1:5:3:36,3,0 ./. ./. 0/0:6,0:6:3:0,3,33
|
47
|
+
"""
|
48
|
+
When I parse the record
|
49
|
+
Then I expect rec.pos to contain 10723
|
50
|
+
Then I expect rec.valid? to be true
|
51
|
+
And I expect rec.original? to be false
|
52
|
+
And I expect rec.sample.s1t1? to be false
|
53
|
+
And I expect rec.sample.s3t2? to be true
|
54
|
+
And I expect rec.missing_samples? to be true
|
55
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
Given /^I have input file\(s\) named "(.*?)"$/ do |arg1|
|
3
|
+
@filenames = arg1.split(/,/)
|
4
|
+
end
|
5
|
+
|
6
|
+
When /^I execute "(.*?)"$/ do |arg1|
|
7
|
+
@cmd = arg1 + ' < ' + @filenames[0]
|
8
|
+
end
|
9
|
+
|
10
|
+
Then(/^I expect the named output to match the named output "(.*?)"$/) do |arg1|
|
11
|
+
RegressionTest::CliExec::exec(@cmd,arg1).should be_true
|
12
|
+
end
|
@@ -6,7 +6,7 @@ end
|
|
6
6
|
When(/^I parse the header$/) do
|
7
7
|
expect(@header.column_names.size).to eq 16
|
8
8
|
expect(@header.samples.size).to eq 7
|
9
|
-
expect(@header.samples).to eq ["
|
9
|
+
expect(@header.samples).to eq ["Original", "s1t1", "s2t1", "s3t1", "s1t2", "s2t2", "s3t2"]
|
10
10
|
end
|
11
11
|
|
12
12
|
Given(/^multisample vcf line$/) do |string|
|
@@ -37,37 +37,83 @@ Then(/^I expect rec\.info\.readposranksum to be (\d+)\.(\d+)$/) do |arg1, arg2|
|
|
37
37
|
expect(@rec1.info.readposranksum).to eq 0.815
|
38
38
|
end
|
39
39
|
|
40
|
-
Then(/^I expect rec\.sample\['
|
41
|
-
|
42
|
-
expect(@rec1.sample['BIOPSY17513D'].gt).to eq "0/1"
|
40
|
+
Then(/^I expect rec\.sample\['Original'\]\.gt to be "(.*?)"$/) do |arg1|
|
41
|
+
expect(@rec1.sample['Original'].gt).to eq "0/1"
|
43
42
|
end
|
44
43
|
|
45
|
-
Then(/^I expect rec\.sample\['
|
46
|
-
expect(@rec1.sample['
|
44
|
+
Then(/^I expect rec\.sample\['Original'\]\.ad to be \[(\d+),(\d+)\]$/) do |arg1, arg2|
|
45
|
+
expect(@rec1.sample['Original'].ad).to eq [189,25]
|
47
46
|
end
|
48
47
|
|
49
|
-
Then(/^I expect rec\.sample\['
|
50
|
-
expect(@rec1.sample['
|
48
|
+
Then(/^I expect rec\.sample\['Original'\]\.gt to be \[(\d+),(\d+)\]$/) do |arg1, arg2|
|
49
|
+
expect(@rec1.sample['Original'].gt).to eq "0/1"
|
51
50
|
end
|
52
51
|
|
53
|
-
Then(/^I expect rec\.sample\['
|
54
|
-
expect(@rec1.sample['
|
52
|
+
Then(/^I expect rec\.sample\['s(\d+)t(\d+)'\]\.ad to be \[(\d+),(\d+)\]$/) do |arg1, arg2, arg3, arg4|
|
53
|
+
expect(@rec1.sample['s3t2'].ad).to eq [167,26]
|
55
54
|
end
|
56
55
|
|
57
|
-
Then(/^I expect rec\.sample\['
|
58
|
-
expect(@rec1.sample['
|
56
|
+
Then(/^I expect rec\.sample\['s(\d+)t(\d+)'\]\.dp to be (\d+)$/) do |arg1, arg2, arg3|
|
57
|
+
expect(@rec1.sample['s3t2'].dp).to eq 196
|
59
58
|
end
|
60
59
|
|
61
|
-
Then(/^I expect rec\.sample\['
|
62
|
-
expect(@rec1.sample['
|
60
|
+
Then(/^I expect rec\.sample\['s(\d+)t(\d+)'\]\.gq to be (\d+)$/) do |arg1, arg2, arg3|
|
61
|
+
expect(@rec1.sample['s3t2'].gq).to eq 20
|
63
62
|
end
|
64
63
|
|
65
|
-
Then(/^I expect rec\.sample
|
66
|
-
expect(@rec1.sample.
|
64
|
+
Then(/^I expect rec\.sample\['s(\d+)t(\d+)'\]\.pl to be \[(\d+),(\d+),(\d+)\]$/) do |arg1, arg2, arg3, arg4, arg5|
|
65
|
+
expect(@rec1.sample['s3t2'].pl).to eq [20,0,522]
|
67
66
|
end
|
68
67
|
|
69
|
-
Then(/^I expect rec\.sample\.
|
70
|
-
expect(@rec1.sample.
|
68
|
+
Then(/^I expect rec\.sample\.original\.gt to be \[(\d+),(\d+)\]$/) do |arg1, arg2|
|
69
|
+
expect(@rec1.sample.original.gt).to eq "0/1"
|
71
70
|
end
|
72
71
|
|
72
|
+
Then(/^I expect rec\.sample\.s(\d+)t(\d+)\.pl to be \[(\d+),(\d+),(\d+)\]$/) do |arg1, arg2, arg3, arg4, arg5|
|
73
|
+
expect(@rec1.sample.s3t2.pl).to eq [20,0,522]
|
74
|
+
end
|
75
|
+
|
76
|
+
Then(/^I expect rec\.original\.gt to be \[(\d+),(\d+)\]$/) do |arg1, arg2|
|
77
|
+
expect(@rec1.original.gt).to eq "0/1"
|
78
|
+
end
|
79
|
+
|
80
|
+
Then(/^I expect rec\.s(\d+)t(\d+)\.pl to be \[(\d+),(\d+),(\d+)\]$/) do |arg1, arg2, arg3, arg4, arg5|
|
81
|
+
expect(@rec1.s3t2.pl).to eq [20,0,522]
|
82
|
+
end
|
83
|
+
|
84
|
+
Then(/^I expect test rec\.missing_samples\? to be false$/) do
|
85
|
+
expect(@rec1.missing_samples?).to be false
|
86
|
+
end
|
87
|
+
|
88
|
+
Then(/^I expect test rec\.original\? to be true$/) do
|
89
|
+
expect(@rec1.original?).to be true
|
90
|
+
end
|
91
|
+
|
92
|
+
Then(/^I expect rec\.missing_samples\? to be true$/) do
|
93
|
+
expect(@rec1.missing_samples?).to be true
|
94
|
+
end
|
95
|
+
|
96
|
+
Then(/^I expect rec\.original\? to be true$/) do
|
97
|
+
expect(@rec1.original?).to be true
|
98
|
+
end
|
99
|
+
|
100
|
+
Given(/^multisample vcf line with missing data$/) do |string|
|
101
|
+
pending # express the regexp above with the code you wish you had
|
102
|
+
end
|
103
|
+
|
104
|
+
Then(/^I expect rec\.original\? to be false$/) do
|
105
|
+
expect(@rec1.original?).to eq false
|
106
|
+
end
|
107
|
+
|
108
|
+
Then(/^I expect rec\.sample\.s(\d+)t(\d+)\? to be false$/) do |arg1, arg2|
|
109
|
+
expect(@rec1.sample.s1t1?).to eq false
|
110
|
+
end
|
111
|
+
|
112
|
+
Then(/^I expect rec\.sample\.s(\d+)t(\d+)\? to be true$/) do |arg1, arg2|
|
113
|
+
expect(@rec1.sample.s3t2?).to eq true
|
114
|
+
end
|
115
|
+
|
116
|
+
Then(/^I expect rec\.valid\? to be true$/) do
|
117
|
+
expect(@rec1.valid?).to eq true
|
118
|
+
end
|
73
119
|
|