| 1 | #Copyright (c) 2010 Joachim Bargsten <code at bargsten dot org>. All rights reserved. | ||
| 2 | |||
| 3 | package Bio::Matrix::IO::mcl; | ||
| 4 | |||
| 5 | use Mouse; | ||
| 6 | |||
| 7 | use MouseX::Foreign 'Bio::Matrix::IO'; | ||
| 8 | |||
| 9 | use warnings; | ||
| 10 | use strict; | ||
| 11 | |||
| 12 | use 5.010; | ||
| 13 | our $VERSION = '0.062'; # VERSION | ||
| 14 | |||
| 15 | with 'Bio::Gonzales::Role::BioPerl::Constructor'; | ||
| 16 | |||
| 17 | sub next_matrix { | ||
| 18 | confess 'not implemented'; | ||
| 19 | } | ||
| 20 | |||
| 21 | sub write_matrix { | ||
| 22 | my ( $self, @matricies ) = @_; | ||
| 23 | foreach my $matrix (@matricies) { | ||
| 24 | |||
| 25 | my @rows = $matrix->row_names; | ||
| 26 | my @cols = $matrix->column_names; | ||
| 27 | |||
| 28 | my $str; | ||
| 29 | for ( my $i = 0; $i < @rows; $i++ ) { | ||
| 30 | my @row = $matrix->get_row( $rows[$i] ); | ||
| 31 | for ( my $j = 0; $j < $i; $j++ ) { | ||
| 32 | $str .= "$rows[$i] $cols[$j] $row[$j]\n"; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | $self->_print($str); | ||
| 36 | } | ||
| 37 | |||
| 38 | } | ||
| 39 | |||
| 40 | 1; |