blib/lib/Bio/Gonzales/Matrix/IO/csv.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 54 CC 2 SCAR 10.3
CC
2
Cov
0%
write_matrix
6.0
next_matrix
2.0
BEGIN
2.0
CRAP 2.8
1 #Copyright (c) 2010 Joachim Bargsten <code at bargsten dot org>. All rights reserved.
2  
3 package Bio::Gonzales::Matrix::IO::csv;
4  
5 use Mouse;
6  
7 use MouseX::Foreign 'Bio::Matrix::IO';
8  
9 use List::MoreUtils qw/any/;
10 use Data::Dumper;
11  
12 use warnings;
13 use strict;
14  
15 use 5.010;
16 our $VERSION = '0.062'; # VERSION
17  
18 with 'Bio::Gonzales::Role::BioPerl::Constructor';
19  
20 has 'na_value' => (is => 'rw', required => 1);
21  
22 sub next_matrix {
23 confess 'not implemented';
24 }
25  
26 sub write_matrix {
27 my ( $self, @matricies ) = @_;
28 foreach my $matrix (@matricies) {
29  
30 my @row_names = $matrix->row_names;
31 my @col_names = $matrix->column_names;
32  
33 my $str = join( "\t", @col_names );
34 $str .= "\n";
35 for ( my $i = 0; $i < @row_names; $i++ ) {
36 my @row = $matrix->get_row( $row_names[$i] );
37 @row = map { $_ < 0 ? $self->na_value : $_ } @row;
38 $str .= join "\t", ( $row_names[$i], @row );
39 $str .= "\n";
40 }
41 $self->_print($str);
42 }
43 }
44  
45 1;
46