Turner_Modulo.pm untested

filter: Statementstmt 0.0% 0 / 42 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 57 CC 4 SCAR 22.2
CC
4
Cov
0%
preformat_data_file
20.0
is_kinetic
2.0
BEGIN
2.0
CRAP 9.2
1 package File::Convert::Turner_Modulo;
2
3 =head1
4
5 ;version,4
6 PlateResults
7 ,Read 1
8 ,,1,2,3,4,5,6,7,8,9,10,11,12
9 ,A,54.0001,62.0002,44.0001,44.0001,48.0001,52.0001,50.0001,64.0002,64.0002,52.0001,60.0002,72.0002
10 ,B,3470.58,2638.33,2154.22,3388.55,3822.7,3228.5,922.041,1628.13,2866.39,3658.64,1962.19,812.032
11 ,C,1530.11,2872.4,2246.24,2838.39,2510.3,3626.63,1906.17,1636.13,2750.36,2220.24,1772.15,2030.2
12 ,D,1938.18,4470.96,4655.04,4510.98,2804.38,4156.83,1958.18,1468.1,3850.71,2510.3,2382.27,2304.25
13 ,E,2574.32,5967.71,5013.21,5521.46,4360.91,4827.12,3022.44,3426.56,4811.11,2380.27,2004.19,2136.22
14 ,F,1310.08,5007.2,3426.56,2900.4,2516.3,3682.65,1220.07,546.014,3182.49,2888.4,2584.32,2122.22
15 ,G,1792.15,4815.11,3852.71,2446.29,2298.25,1872.17,974.046,858.035,1880.17,1420.1,1748.15,2030.2
16 ,H,1510.11,1754.15,3044.44,3118.47,1836.16,1328.08,672.022,406.008,986.047,814.032,1446.1,1736.14
17
18 ProtocolHeader
19 ,Version,,1.0
20 ,Label,,mue.AandB.8Nov.25ul
21 ,Locked,,False
22 ,Creator,,User
23 ,ReaderType,,1
24 ,Category,,0
25 ,FluoroFilter,,4
26 ,DateRead,,11/8/2007 7:03:36 PM
27 ,Filename,,beforeAcII_mue.AandB.8Nov.25ul_11-8-2007_7-03-36 PM
28 ,InstrumentSN,,SN: 930000207060
29 ,FluoOpticalKitID,,
30 ,Result,,0
31 ,Prefix,,beforeAcII
32 ,WellMap,,FFFFFFFFFFFFFFFFFFFFFFFF
33 ,RefWellMap,,000000000000000000000000
34 ,RunCount,,1
35 ,RunPeriod,,60
36 ,PreRunDelay,,0
37 ,Kinetics,,False
38 ,KineticCount,,10
39 ,KineticIntTime,,0.5
40
41 Steps
42 ,Injector,,0,1
43 ,Inject,,False,False
44 ,Volume,,25,25
45 ,Delay,,0.5,3
46 ,Read,,True,False
47 ,PostDelay,,0,0
48 ,IntegrationTime,,0.5,0.5
49 ,WavelengthCount,,1,1
50 ,Wavelength1,,450,450
51 ,Wavelength2,,450,450
52
53 Results
54 ,Well,Read 1
55 ,A1,54.0001
56
57 =cut
58
59 use strict;
60 use warnings;
61
62 use File::Convert::CSV;
63
64 use Data::Iter qw(:all);
65
66 use Data::Dump qw(dump);
67
68 Class::Maker::class
69 {
70 isa => [qw( File::Convert::CSV )],
71
72 public =>
73 {
74 hash => [qw( file_info )],
75 },
76
77 default =>
78 {
79 has_header => 1,
80
81 separator => ",",
82
83 skip_pattern => qr/^;/,
84
85 skip_callback => sub { warn "Skipped line", @_ }
86
87 },
88 };
89
90 sub is_kinetic : method
91 {
92 my $this = shift;
93
94 return join( '', @{ $this->data_file } ) =~ /PlateResults/mi;
95 }
96
97 sub preformat_data_file : method
98 {
99 my $this = shift;
100
101
102 my $result;
103
104 $this->d_croak( "Results is a field expected in each Turner Modulo Results file. This was not found and format is putativly wrong." ) unless join( '', @{ $this->data_file } ) =~ /Results/mi;
105
106 for( iter scalar $this->data_file )
107 {
108 if( VALUE() =~ /^,Well,/ )
109 {
110 splice @{$this->data_file}, 0, COUNTER-1;
111
112 $this->d_warn( "FILE_INFO %s", Data::Dump::dump( { $this->file_info } ) );
113
114 return;
115 }
116
117 $this->d_warn( "omitting header line %s", VALUE() );
118
119 my $line = VALUE();
120
121 chomp $line;
122
123 $line =~ s/\r$//gi;
124
125 if( $line =~ /,,/ )
126 {
127 my ($key, $value ) = split /\s?,,\s?/, $line;
128
129 $this->file_info->{$key} = $value;
130 }
131 }
132 }
133
134 1;