Microarray/File.pm

filter: Statementstmt 12.2% 31 / 253 Branchbran 0.0% 0 / 92 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 14.0% 7 / 50 Podpod n/a totaltotal 9.2% 38 / 409 CC 53 SCAR 33.1
CC
53
Cov
9%
parse_line
152.3
clean_line_ends
30.0
add_text
30.0
CRAP 27.4
« Microarray/File/Data/Quantarray.pm ↑ Summary Microarray/Image/CGH_Plot.pm »
1 package Microarray::File;
2  
3 4 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 our $VERSION = '1.24';
7  
8 { package microarray_file;
9  
10 0 ▶ sub new {
Subroutine new: not called CC=3 SCAR=24.8
11 0 my $class = shift;
12 0 my $self = { };
13 0 ▶ if (@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
14 0 $self->{ _file_name } = shift; # shift in file name
15 0 bless $self, $class;
16 0 ▶ $self->set_filehandle(shift) if (@_); # Fh is passed from CGI
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
17 0 $self->import_data;
18 } else {
19 0 bless $self, $class;
20 }
21 0 return $self;
22 }
23 0 ▶ sub DESTROY {
Subroutine DESTROY: not called CC=2 SCAR=17.9
24 0 my $self = shift;
25 0 ▶ if (defined $self->{ _filehandle }){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"_filehandle"}) 0 0 0
26 0 my $filehandle = $self->{ _filehandle };
27 0 close $filehandle;
28 }
29 }
30 0 ▶ sub filehandle {
Subroutine filehandle: not called CC=2 SCAR=17.9
31 0 my $self = shift;
32 0 ▶ unless (defined $self->{ _filehandle }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_filehandle"}) 0 0 0
33 0 $self->set_filehandle;
34 }
35 0 $self->{ _filehandle };
36 }
37 0 ▶ sub set_filehandle {
Subroutine set_filehandle: not called CC=2 SCAR=17.9
38 0 my $self = shift;
39 0 ▶ if (@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
40 0 $self->{ _filehandle } = shift;
41 } else {
42 0 $self->{ _filehandle } = $self->create_filehandle;
43 }
44 0 $self->filehandle_is_set(1);
45 }
46 0 ▶ sub filehandle_is_set {
Subroutine filehandle_is_set: not called CC=2 SCAR=17.9
47 0 my $self = shift;
48 @_ ? $self->{ _filehandle_is_set } = shift
49 0 ▶ : $self->{ _filehandle_is_set };
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
50 }
51 0 ▶ sub create_filehandle {
Subroutine create_filehandle: not called CC=2 SCAR=11.6
52 4 ▶ use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 0 my $self = shift;
54 0 my $file_name = $self->file_name;
55 0 ▶ my $filehandle = new FileHandle "< $file_name" or die
Branch: 1 branch
BranchTrueFalseTotal
my $filehandle = "FileHandle"->new("< $file_name") or die "Microarray::File ERROR: Could not create filehandle for '${file_name}'\n$!\n" 0 0 0
56 "Microarray::File ERROR: Could not create filehandle for '$file_name'\n$!\n";
57 0 return $filehandle;
58 }
59 0 ▶ sub close_filehandle {
Subroutine close_filehandle: not called CC=2 SCAR=17.9
60 0 my $self = shift;
61 0 my $filehandle = $self->filehandle;
62 0 ▶ close $filehandle or die
Branch: 1 branch
BranchTrueFalseTotal
close $filehandle or die "Microarray::File ERROR: Could not close filehandle\n$!\n" 0 0 0
63 "Microarray::File ERROR: Could not close filehandle\n$!\n";
64 }
65 0 ▶ sub reset_filehandle {
Subroutine reset_filehandle: not called CC=2 SCAR=17.9
66 0 my $self = shift;
67 0 my $file_handle = $self->filehandle;
68 0 ▶ close $file_handle or die "Microarray::File ERROR: Can't close filehandle\n";
Branch: 1 branch
BranchTrueFalseTotal
close $file_handle or die "Microarray::File ERROR: Can't close filehandle\n" 0 0 0
69 0 delete $self->{ _filehandle };
70 0 delete $self->{ _filehandle_is_set };
71 }
72 0 ▶ sub file_name {
Subroutine file_name: not called CC=2 SCAR=17.9
73 0 my $self = shift;
74 @_ ? $self->{ _file_name } = shift
75 0 ▶ : $self->{ _file_name };
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
76 }
77 0 ▶ sub import_data {
Subroutine import_data: not called CC=1 SCAR=6.9
78 0 return; # no default method in class microarray_file
79 }
80 0 ▶ sub get_header_info {
Subroutine get_header_info: not called CC=3 SCAR=24.8
81 0 my $self = shift;
82 0 ▶ unless ( defined $self->{ _header_info } ){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_header_info"}) 0 0 0
83 0 $self->set_header_info;
84 }
85 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
86 0 my $key = shift;
87 0 my $hHeader_Info = $self->{ _header_info };
88 0 return $hHeader_Info->{ $key };
89 } else {
90 0 $self->{ _header_info };
91 }
92 }
93 0 ▶ sub get_header_keys {
Subroutine get_header_keys: not called CC=1 SCAR=6.9
94 0 my $self = shift;
95 0 my $hHeader_Info = $self->get_header_info;
96 0 return keys %$hHeader_Info;
97 }
98 }
99  
100 4 { package microarray_text_file;
101  
102 4 our @ISA = qw( microarray_file );
103  
104 0 ▶ sub set_source {
Subroutine set_source: not called CC=1 SCAR=6.9
105 0 my $self = shift;
106 0 $self->{ _source } = $self->import_clean_source;
107 }
108 0 ▶ sub get_source {
Subroutine get_source: not called CC=2 SCAR=17.9
109 0 my $self = shift;
110 0 ▶ unless (defined $self->{ _source }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_source"}) 0 0 0
111 0 $self->set_source;
112 }
113 0 $self->{ _source };
114 }
115 0 ▶ sub import_clean_source {
Subroutine import_clean_source: not called CC=3 SCAR=24.8
116 0 my $self = shift;
117 0 my $source;
118 0 ▶ if ($self->filehandle_is_set){
Branch: 2 branches
BranchTrueFalseTotal
if ($self->filehandle_is_set) { } 0 0 0
elsif ($self->file_name) { } 0 0 0
119 0 $source = $self->source_from_filehandle;
120 } elsif ($self->file_name) {
121 0 $source = $self->source_from_filename;
122 } else {
123 0 my $class = ref $self;
124 0 die "Microarray::File::$class ERROR: No filehandle, file name or database BLOB was provided. Could not import\n";
125 }
126 0 $source =~ s/(?:\015{1,2}\012|\015|\012)/\n/gs; # clean line ends
127 0 $self->have_cleaned_ends(1);
128 0 return $source;
129 }
130 0 ▶ sub source_from_filehandle {
Subroutine source_from_filehandle: not called CC=1 SCAR=6.9
131 0 my $self = shift;
132 0 my $file_handle = $self->filehandle;
133 0 my $source = do { local($/); <$file_handle> }; # slurp in the file
134 0 return $source;
135 }
136 0 ▶ sub source_from_filename {
Subroutine source_from_filename: not called CC=1 SCAR=0.6
137 4 ▶ use File::Slurp;
Subroutine BEGIN: called CC=1 SCAR=0.0
138 0 my $self = shift;
139 0 File::Slurp::read_file( $self->file_name );
140 }
141 # import_data defaults to set_source
142 0 ▶ sub import_data {
Subroutine import_data: not called CC=1 SCAR=6.9
143 0 my $self = shift;
144 0 $self->set_source;
145 }
146 0 ▶ sub line_num {
Subroutine line_num: not called CC=2 SCAR=17.9
147 0 my $self = shift;
148 @_ ? $self->{ _line_num } = shift
149 0 ▶ : $self->{ _line_num };
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
150 }
151 # cleans line ends from different systems to standard /n
152 0 ▶ sub clean_line_ends {
Subroutine clean_line_ends: not called CC=5 SCAR=34.0
153 0 my $self = shift;
154 0 ▶ return if ($self->have_cleaned_ends);
Branch: 1 branch
BranchTrueFalseTotal
if $self->have_cleaned_ends 0 0 0
155 0 my $file_handle = $self->filehandle;
156 0 my $file_name = $self->file_name;
157 0 ▶ open (TEMPFILE, '>', "$file_name.temp") or die "Microarray::File ERROR: Can't open temp file for writing";
Branch: 1 branch
BranchTrueFalseTotal
open TEMPFILE, ">", "$file_name.temp" or die "Microarray::File ERROR: Can't open temp file for writing" 0 0 0
158 0 ▶ while (<$file_handle>){
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $file_handle)) 0 0 0
159 0 my $input_line = $_;
160 0 $input_line =~ s/(?:\015{1,2}\012|\015|\012)/\n/gs; # clean line ends
161 0 print TEMPFILE $input_line;
162 }
163 0 $self->reset_filehandle;
164 0 ▶ close TEMPFILE or die "Microarray::File ERROR: Can't close the temp file";
Branch: 1 branch
BranchTrueFalseTotal
close TEMPFILE or die "Microarray::File ERROR: Can't close the temp file" 0 0 0
165 0 rename ("$file_name.temp",$file_name);
166 0 $self->have_cleaned_ends(1);
167 }
168 0 ▶ sub have_cleaned_ends {
Subroutine have_cleaned_ends: not called CC=2 SCAR=17.9
169 0 my $self = shift;
170 @_ ? $self->{ _have_cleaned_ends } = shift
171 0 ▶ : $self->{ _have_cleaned_ends };
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
172 }
173  
174 }
175  
176 4 { package delimited_file;
177  
178 # delimited file, but not a simple columnar format
179  
180 4 our @ISA = qw( microarray_text_file );
181  
182 # default load incorporates split on a delimiter, and line end cleaning
183 0 ▶ sub load_file_data {
Subroutine load_file_data: not called CC=2 SCAR=17.9
184 0 my $self = shift;
185 0 my $source = $self->get_source;
186 0 my @aLines = split(/\n/,$source);
187 0 my @aaArray_From_File;
188 0 my $delimiter = $self->delimiter;
189 0 foreach (@aLines){
190 0 s/\"//g;
191 0 my @aCells = split(/$delimiter/,$_);
192 0 push (@aaArray_From_File, \@aCells);
193 }
194 0 return \@aaArray_From_File;
195 }
196 # parse_line extracted from Text::ParseWords and adapted
197 # to return an array reference instead of an array
198 0 ▶ sub parse_line {
Subroutine parse_line: not called CC=13 SCAR=50.3
199 0 our $PERL_SINGLE_QUOTE;
200 4 ▶ no warnings; # We will be testing undef strings
Subroutine BEGIN: called CC=1 SCAR=0.0
201 0 my($delimiter, $line) = @_;
202 0 my($word, @pieces);
203  
204 0 ▶ while (length($line)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $line) 0 0 0
205 0 ▶ $line =~ s/^(["']) # a $quote
Branch: 1 branch
BranchTrueFalseTotal
$line =~ s/^(["']) # a $quote ((?:\\.|(?!\1)[^\\])*) # and $quoted text \1 # followed by the same quote | # --OR-- ^((?:\\.|[^\\"'])*?) # an $unquoted text (\Z(?!\n)|(?-x:$delimiter)|(?!^)(?=["'])) # plus EOL, delimiter, or quote //sx or return 0 0 0
206 ((?:\\.|(?!\1)[^\\])*) # and $quoted text
207 \1 # followed by the same quote
208 | # --OR--
209 ^((?:\\.|[^\\"'])*?) # an $unquoted text
210 (\Z(?!\n)|(?-x:$delimiter)|(?!^)(?=["']))
211 # plus EOL, delimiter, or quote
212 //xs or return; # extended layout
213 0 my($quote, $quoted, $unquoted, $delim) = ($1, $2, $3, $4);
214 0 ▶ return() unless( defined($quote) || length($unquoted) || length($delim));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $quote or length $unquoted or length $delim 0 0 0
Condition0%0/6
defined $quote or length $unquoted or length $delim
l!l&&r!l&&!r
000
defined $quote or length $unquoted
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $quote or length $unquoted or length $delim
defined $quote length $unquoted length $delim
Truth table0%0/4
A or B or C
A= defined $quoteB= length $unquotedC= length $delim
ABCresult
1XX1
01X1
0011
0000
215  
216 0 $unquoted =~ s/\\(.)/$1/sg;
217 0 ▶ if (defined $quote) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $quote) 0 0 0
218 0 ▶ $quoted =~ s/\\(.)/$1/sg if ($quote eq '"');
Branch: 1 branch
BranchTrueFalseTotal
if $quote eq "\"" 0 0 0
219 0 ▶ $quoted =~ s/\\([\\'])/$1/g if ( $PERL_SINGLE_QUOTE && $quote eq "'");
Branch: 1 branch
BranchTrueFalseTotal
if $delimited_file::PERL_SINGLE_QUOTE and $quote eq "'" 0 0 0
Condition0%0/3
$delimited_file::PERL_SINGLE_QUOTE and $quote eq "'"
!ll&&!rl&&r
000
MC/DC0%0/2
$delimited_file::PERL_SINGLE_QUOTE and $quote eq "'"
$delimited_file::PERL_SINGLE_QUOTE $quote eq "'"
Truth table0%0/3
A and B
A= $delimited_file::PERL_SINGLE_QUOTEB= $quote eq "'"
ABresult
0X0
100
111
220 }
221 0 ▶ $word .= defined $quote ? $quoted : $unquoted;
Branch: 1 branch
BranchTrueFalseTotal
defined $quote ? : 0 0 0
222
223 0 ▶ if (length($delim)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $delim) 0 0 0
224 0 push(@pieces, $word);
225 0 undef $word;
226 }
227 0 ▶ if (!length($line)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $line) 0 0 0
228 0 push(@pieces, $word);
229 }
230 }
231 0 return(\@pieces);
232 }
233 0 ▶ sub delimiter {
Subroutine delimiter: not called CC=2 SCAR=17.9
234 0 my $self = shift;
235 0 ▶ unless (defined $self->{ _delimiter }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_delimiter"}) 0 0 0
236 0 $self->set_delimiter;
237 }
238 0 $self->{ _delimiter };
239 }
240 0 ▶ sub set_delimiter {
Subroutine set_delimiter: not called CC=2 SCAR=17.9
241 0 my $self = shift;
242 0 ▶ if ($self->file_name =~ /.csv$/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->file_name =~ /.csv$/i) { } 0 0 0
243 0 $self->{ _delimiter } = ",";
244 } else {
245 0 $self->{ _delimiter } = "\t";
246 }
247 }
248
249 ### the following methods provide a key to store/retrieve
250 ### column headers from the file data
251
252 # column headers of the data
253 0 ▶ sub set_data_fields {
Subroutine set_data_fields: not called CC=3 SCAR=24.8
254 0 my $self = shift;
255 0 my $aData_Fields = shift;
256 0 ▶ die "Data Fields were not loaded correctly. Maybe you chose the wrong data file type?\n" unless $aData_Fields;
Branch: 1 branch
BranchTrueFalseTotal
unless $aData_Fields 0 0 0
257 0 my $hData_Fields = { };
258 0 ▶ for (my $i=0; $i < @$aData_Fields; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @$aData_Fields) 0 0 0
259 0 my $field = $$aData_Fields[$i];
260 0 $$hData_Fields{ $field } = $i;
261 0 $$hData_Fields{ $i } = $field;
262 }
263 0 $self->{ _data_fields } = $hData_Fields; # column headers of the data
264 }
265 0 ▶ sub get_data_fields {
Subroutine get_data_fields: not called CC=2 SCAR=17.9
266 0 my $self = shift;
267 0 ▶ unless (defined $self->{ _data_fields }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_data_fields"}) 0 0 0
268 0 my $aaData = $self->get_source;
269 0 $self->set_data_fields(shift @$aaData);
270 }
271 0 $self->{ _data_fields };
272 }
273 # return column name from index, or vice versa
274 0 ▶ sub get_column_id {
Subroutine get_column_id: not called CC=1 SCAR=6.9
275 0 my $self = shift;
276 0 my $column_id = shift;
277 0 my $hColumn_Id = $self->get_data_fields;
278 0 $hColumn_Id->{ $column_id };
279 }
280 ## copied from simple delimited file for quantarray_data package
281 0 ▶ sub set_imported_data {
Subroutine set_imported_data: not called CC=1 SCAR=6.9
282 0 my $self = shift;
283 0 my $aaData = shift;
284 0 $self->{ _imported_data } = $aaData;
285 }
286 0 ▶ sub get_imported_data {
Subroutine get_imported_data: not called CC=1 SCAR=6.9
287 0 my $self = shift;
288 0 $self->{ _imported_data };
289 }
290 }
291  
292 4 { package simple_delimited_file;
293  
294 # simple delimited spreadsheet format, with a column header row
295
296 4 our @ISA = qw( delimited_file );
297  
298 0 ▶ sub import_data {
Subroutine import_data: not called CC=1 SCAR=6.9
299 0 my $self = shift;
300 0 my $aaData = $self->load_file_data; # from package delimited_file
301 0 my $line_num = @$aaData;
302 0 $self->line_num($line_num-1); # ignore column header
303 0 $self->sort_data($aaData);
304 }
305 0 ▶ sub sort_data {
Subroutine sort_data: not called CC=1 SCAR=6.9
306 0 my $self = shift;
307 0 my $aaData = shift;
308 0 my $aCol_Headers = shift @$aaData;
309 0 $self->set_imported_data($aaData);
310 0 $self->column_num(scalar @$aCol_Headers);
311 0 $self->set_data_fields($aCol_Headers);
312 }
313 0 ▶ sub set_imported_data {
Subroutine set_imported_data: not called CC=1 SCAR=6.9
314 0 my $self = shift;
315 0 my $aaData = shift;
316 0 $self->{ _imported_data } = $aaData;
317 }
318 0 ▶ sub get_imported_data {
Subroutine get_imported_data: not called CC=1 SCAR=6.9
319 0 my $self = shift;
320 0 $self->{ _imported_data };
321 }
322 # count of the number of columns in the original data set
323 0 ▶ sub column_num {
Subroutine column_num: not called CC=2 SCAR=17.9
324 0 my $self = shift;
325 @_ ? $self->{ _column_num } = shift
326 0 ▶ : $self->{ _column_num };
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
327 }
328 # compares the number of fields returned by get_data_fields
329 # with the number of columns in the original file
330 # returns true if they are the same, false otherwise
331 0 ▶ sub check_col_numbers {
Subroutine check_col_numbers: not called CC=2 SCAR=17.9
332 0 my $self = shift;
333 0 my $col_num = $self->column_num;
334 0 my $hData_Fields = $self->get_data_fields;
335 0 my $keys = keys %$hData_Fields;
336 0 ▶ if ($col_num = $keys){
Branch: 1 branch
BranchTrueFalseTotal
if ($col_num = $keys) { } 0 0 0
337 0 return 1;
338 } else {
339 0 return;
340 }
341 }
342 # hash ref to be filled with hash refs of row data
343 0 ▶ sub get_data_rows {
Subroutine get_data_rows: not called CC=2 SCAR=17.9
344 0 my $self = shift;
345 0 ▶ unless (defined $self->{ _data_rows }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_data_rows"}) 0 0 0
346 0 $self->{ _data_rows } = { };
347 }
348 0 $self->{ _data_rows };
349 }
350 0 ▶ sub get_data_row {
Subroutine get_data_row: not called CC=1 SCAR=6.9
351 0 my $self = shift;
352 0 my $row = shift;
353 0 my $hhData_Rows = $self->get_data_rows;
354 0 return $hhData_Rows->{ $row };
355 }
356 0 ▶ sub import_cells {
Subroutine import_cells: not called CC=4 SCAR=30.0
357 0 my $self = shift;
358
359 0 my $aaData = $self->get_imported_data;
360 0 my $key_col = $self->key_column;
361 0 my $hhData_Rows = $self->get_data_rows;
362 0 my $row = 1;
363 0 for my $aData_Row (@$aaData){
364 0 my %hData_Row = ();
365 0 ▶ for (my $i=0; $i<@$aData_Row; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @$aData_Row) 0 0 0
366 0 my $value = $aData_Row->[$i];
367 0 $hData_Row{ $self->get_column_id($i) } = $value;
368 }
369 0 ▶ if ($key_col == -1){
Branch: 1 branch
BranchTrueFalseTotal
if ($key_col == -1) { } 0 0 0
370 0 $hhData_Rows->{ $row } = \%hData_Row;
371 } else {
372 0 $hhData_Rows->{ $aData_Row->[$key_col] } = \%hData_Row;
373 }
374 0 $row++;
375 }
376 }
377 #Êthe name column header providing the 'primary key'
378 # returns the index number of that header
379 # -1 indicates to use row number
380 0 ▶ sub key_column {
Subroutine key_column: not called CC=3 SCAR=24.8
381 0 my $self = shift;
382 0 ▶ if (@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
383 0 $self->{ _key_column } = $self->get_column_id(shift);
384 } else {
385 0 ▶ unless (defined $self->{ _key_column }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_key_column"}) 0 0 0
386 0 $self->{ _key_column } = -1;
387 }
388 0 $self->{ _key_column };
389 }
390 }
391 }
392  
393 4 { package log_file;
394  
395 4 our @ISA = qw( microarray_text_file );
396
397 0 ▶ sub create_filehandle {
Subroutine create_filehandle: not called CC=2 SCAR=11.6
398 4 ▶ use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
399 0 my $self = shift;
400 0 my $file_name = $self->file_name;
401 0 ▶ my $filehandle = new FileHandle ">> $file_name" or die
Branch: 1 branch
BranchTrueFalseTotal
my $filehandle = "FileHandle"->new(">> $file_name") or die "Microarray::File ERROR: Could not create filehandle for '${file_name}'\n$!\n" 0 0 0
402 "Microarray::File ERROR: Could not create filehandle for '$file_name'\n$!\n";
403 0 return $filehandle;
404 }
405 0 ▶ sub load_file_data {
Subroutine load_file_data: not called CC=1 SCAR=6.9
406 0 my $self = shift;
407 0 my $source = $self->get_source;
408 0 my @aLines = split(/\n/,$source);
409 0 return \@aLines;
410 }
411 0 ▶ sub add_text {
Subroutine add_text: not called CC=5 SCAR=34.0
412 0 my $self = shift;
413 0 my $file_handle = $self->filehandle;
414 0 ▶ while (@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
415 0 my $text = shift;
416 0 ▶ return unless $text;
Branch: 1 branch
BranchTrueFalseTotal
unless $text 0 0 0
417 0 ▶ if (ref $text){
Branch: 1 branch
BranchTrueFalseTotal
if (ref $text) { } 0 0 0
418 0 for my $line (@$text){
419 0 print $file_handle $line."\n";
420 }
421 } else {
422 0 print $file_handle $text."\n";
423 }
424 }
425 }
426 }
427  
428  
429  
430 4 1;
431  
432 __END__
« Microarray/File/Data/Quantarray.pm ↑ Summary Microarray/Image/CGH_Plot.pm »