Debian Codegraph @

features/step_definitions/diff_count.rb

raw
1
2 Given(/^normal and tumor counts \[(\d+),(\d+),(\d+),(\d+)\] and \[(\d+),(\d+),(\d+),(\d+)\]$/) do |arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8|
3 @normal = [arg1,arg2,arg3,arg4].map{|i|i.to_i}
4 @tumor = [arg5,arg6,arg7,arg8].map{|i|i.to_i}
5 end
6
7 When(/^I look for the difference$/) do
8 end
9
10 Then(/^I expect the diff to be \[(\d+),(\d+),(\d+),(\d+)\]$/) do |arg1, arg2, arg3, arg4|
11 expect(Variant.diff(@normal,@tumor)).to eq [arg1.to_i,arg2.to_i,arg3.to_i,arg4.to_i]
12 end
13
14 Then(/^the relative diff to be \[(\d+),(\d+)\.(\d+),(\d+),(\d+)\.(\d+)\]$/) do |arg1, arg2, arg3, arg4, arg5, arg6|
15 res = [arg1.to_f,(arg2+'.'+arg3).to_f,arg4.to_i,(arg5+'.'+arg6).to_f]
16 expect(Variant.relative_diff(@normal,@tumor)).to eq res
17 end
18
19 Then(/^I expect the defining tumor nucleotide to be "(.*?)"$/) do |arg1|
20 expect(['A','C','G','T'][Variant.index(@normal,@tumor)]).to eq arg1
21 end
22
23 Then(/^I expect the tumor count to be (\d+)$/) do |arg1|
24 expect(@tumor[Variant.index(@normal,@tumor)]).to eq arg1.to_i
25 end
26
27 When(/^I set an inclusion threshold for the reference$/) do
28 end
29
30 Then(/^I expect the diff for threshold (\d+) to be \[(\d+),(\d+),(\d+),(\d+)\]$/) do |arg1, arg2, arg3, arg4, arg5|
31 @t = arg1.to_i
32 @t_diff = Variant.threshold_diff(@t,@normal,@tumor)
33 expect(@t_diff).to eq [arg2.to_i,arg3.to_i,arg4.to_i,arg5.to_i]
34 end
35
36 Then(/^the relative diff to be \[(\d+),(\d+),(\d+),(\d+)\.(\d+)\]$/) do |arg1, arg2, arg3, arg4, arg5|
37 res = [arg1.to_f,arg2.to_i,arg3.to_i,(arg4.to_s+'.'+arg5.to_s).to_f]
38 expect(Variant.relative_threshold_diff(@t,@normal,@tumor)).to eq res
39 end
40
41