Taqman.pm untested

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 65 CC 5 SCAR 22.3
CC
5
Cov
0%
preformat_data_file
20.0
is_file_valid
6.0
BEGIN
2.0
CRAP 9.3
1 package File::Convert::Taqman;
2
3 =head1
4
5 Document Name: dok
6 Plate Type: Absolute Quantification
7 User: 7300Anwender
8
9 Document Information
10
11 Operator: 7300Anwender
12 Run Date: Monday, January 08, 2007 20:21:13
13 Last Modified: Monday, January 08, 2007 23:43:38
14 Instrument Type: Applied Biosystems 7300 Real-Time PCR System
15
16 Comments:
17 SDS v1.2
18
19 Well,Sample Name,Detector,Task,Ct,StdDev Ct,Qty,Mean Qty,StdDev Qty,Filtered,Tm
20 ....
21 =cut
22
23 use strict;
24 use warnings;
25
26 use File::Convert::CSV;
27
28 use Data::Iter qw(:all);
29
30 use Data::Dump qw(dump);
31
32 Class::Maker::class
33 {
34 isa => [qw( File::Convert::CSV )],
35
36 public =>
37 {
38 hash => [qw( file_info )],
39 },
40
41 default =>
42 {
43 has_header => 1,
44
45 separator => ",",
46
47 skip_pattern => qr/^#/,
48
49 skip_callback => sub {}
50
51 },
52 };
53
54 sub is_file_valid : method
55 {
56 my $this = shift;
57
58 my $file = shift;
59
60
61 open( FILE, $file ) or return 0;
62
63 #$this->d_croak( "Only file format 'SDS v1.2' from the 'Applied Biosystems 7300 Real-Time PCR System' supported" ) unless join( '', @{ $this->data_file } ) =~ /SDS v1\.2/mi;
64
65 my $data_file = join( '', <FILE> );
66
67 if( $data_file =~ /SDS v1\.2/mi )
68 {
69 return 1;
70 }
71
72 return 0;
73 }
74
75 sub preformat_data_file : method
76 {
77 my $this = shift;
78
79
80 my $result;
81
82 $this->d_croak( "Only file format 'SDS v1.2' from the 'Applied Biosystems 7300 Real-Time PCR System' supported" ) unless join( '', @{ $this->data_file } ) =~ /SDS v1\.2/mi;
83
84 for( iter scalar $this->data_file )
85 {
86 if( VALUE() =~ /^Well/ )
87 {
88 splice @{$this->data_file}, 0, COUNTER-1;
89
90 $this->d_warn( "FILE_INFO %s", Data::Dump::dump( { $this->file_info } ) );
91
92 return;
93 }
94
95 $this->d_warn( "omitting header line %s", VALUE() );
96
97 my $line = VALUE();
98
99 chomp $line;
100
101 $line =~ s/\r$//gi;
102
103 if( $line =~ /:/ )
104 {
105 my ($key, $value ) = split /\s?:\s?/, $line;
106
107 $this->file_info->{$key} = $value;
108 }
109 }
110 }
111
112 1;