| 1 | # BioPerl module for Bio::Matrix::PhylipDist | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # Cared for by Shawn Hoon <shawnh@fugu-sg.org> | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # Copyright Shawn Hoon | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | Bio::Matrix::PhylipDist - A Phylip Distance Matrix object | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | use Bio::Tools::Phylo::Phylip::ProtDist; | ||||||||||||||||||||||||||||||||||||||||||
| 21 | my $dist = Bio::Tools::Phylo::Phylip::ProtDist->new( | ||||||||||||||||||||||||||||||||||||||||||
| 22 | -file=>"protdist.out", | ||||||||||||||||||||||||||||||||||||||||||
| 23 | -program=>"ProtDist"); | ||||||||||||||||||||||||||||||||||||||||||
| 24 | #or | ||||||||||||||||||||||||||||||||||||||||||
| 25 | my $dist = Bio::Tools::Phylo::Phylip::ProtDist->new( | ||||||||||||||||||||||||||||||||||||||||||
| 26 | -fh=>"protdist.out", | ||||||||||||||||||||||||||||||||||||||||||
| 27 | -program=>"ProtDist"); | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | #get specific entries | ||||||||||||||||||||||||||||||||||||||||||
| 31 | my $distance_value = $dist->get_entry('ALPHA','BETA'); | ||||||||||||||||||||||||||||||||||||||||||
| 32 | my @columns = $dist->get_column('ALPHA'); | ||||||||||||||||||||||||||||||||||||||||||
| 33 | my @rows = $dist->get_row('BETA'); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | my @diagonal = $dist->get_diagonal(); | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | #print the matrix in phylip numerical format | ||||||||||||||||||||||||||||||||||||||||||
| 37 | print $dist->print_matrix; | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | Simple object for holding Distance Matrices generated by the following Phylip programs: | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 1) dnadist | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 2) protdist | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 3) restdist | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | It currently handles parsing of the matrix without the data output option. | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 5 | ||||||||||||||||||||||||||||||||||||||||||
| 50 | Alpha 0.00000 4.23419 3.63330 6.20865 3.45431 | ||||||||||||||||||||||||||||||||||||||||||
| 51 | Beta 4.23419 0.00000 3.49289 3.36540 4.29179 | ||||||||||||||||||||||||||||||||||||||||||
| 52 | Gamma 3.63330 3.49289 0.00000 3.68733 5.84929 | ||||||||||||||||||||||||||||||||||||||||||
| 53 | Delta 6.20865 3.36540 3.68733 0.00000 4.43345 | ||||||||||||||||||||||||||||||||||||||||||
| 54 | Epsilon 3.45431 4.29179 5.84929 4.43345 0.00000 | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||
| 62 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||||||||||||||||||||||||||||||||||
| 63 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||
| 66 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||
| 75 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||
| 76 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||
| 77 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||
| 82 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||
| 83 | web: | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | =head1 AUTHOR - Shawn Hoon | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | Email shawnh@fugu-sg.org | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | =head1 CONTRIBUTORS | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | Jason Stajich, jason-at-bioperl-dot-org | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | The rest of the documentation details each of the object | ||||||||||||||||||||||||||||||||||||||||||
| 99 | methods. Internal methods are usually preceded with a "_". | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | package Bio::Matrix::PhylipDist; | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 9 | $Bio::Matrix::PhylipDist::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||
| 107 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 9 | ▶ | use base qw(Bio::Root::Root Bio::Matrix::MatrixI); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | Title : new | ||||||||||||||||||||||||||||||||||||||||||
| 115 | Usage : my $family = Bio::Matrix::PhylipDist->new(-file=>"protdist.out", | ||||||||||||||||||||||||||||||||||||||||||
| 116 | -program=>"protdist"); | ||||||||||||||||||||||||||||||||||||||||||
| 117 | Function: Constructor for PhylipDist Object | ||||||||||||||||||||||||||||||||||||||||||
| 118 | Returns : L<Bio::Matrix::PhylipDist> | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 16 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=11 SCAR=27.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 16 | my ($class,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 124 | 16 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 125 | 16 | my ($matrix,$values, $names, | |||||||||||||||||||||||||||||||||||||||||
| 126 | $program,$matname, | ||||||||||||||||||||||||||||||||||||||||||
| 127 | $matid) = $self->_rearrange([qw(MATRIX | ||||||||||||||||||||||||||||||||||||||||||
| 128 | VALUES | ||||||||||||||||||||||||||||||||||||||||||
| 129 | NAMES | ||||||||||||||||||||||||||||||||||||||||||
| 130 | PROGRAM | ||||||||||||||||||||||||||||||||||||||||||
| 131 | MATRIX_NAME | ||||||||||||||||||||||||||||||||||||||||||
| 132 | MATRIX_ID | ||||||||||||||||||||||||||||||||||||||||||
| 133 | )],@args); | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 16 | ▶ | ($matrix && $values && $names) || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$matrix and $values and $names
$matrix and $values
MC/DC0%0/3
$matrix and $values and $names
$matrix
$values
$names
Truth table25%1/4
A and B and C
A= $matrixB= $valuesC= $names
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | $self->throw("Need matrix, values, and names fields all provided!"); | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 16 | ▶ | $program && $self->matrix_name($program) if defined $program; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
defined $program && ($program && $self->matrix_name($program))
$program and $self->matrix_name($program)
MC/DC0%0/3
defined $program && ($program && $self->matrix_name($program))
defined $program
$program
$self->matrix_name($program)
Truth table0%0/4
A && B and C
A= defined $programB= $programC= $self->matrix_name($program)
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 16 | ▶ | $self->_matrix($matrix) if ref($matrix) =~ /HASH/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 16 | ▶ | $self->_values($values) if ref($values) =~ /ARRAY/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 16 | ▶ | $self->names($names) if ref($names) =~ /ARRAY/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 16 | ▶ | $self->matrix_name($matname) if defined $matname; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 16 | ▶ | $self->matrix_id ($matid) if defined $matid; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 16 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | =head2 get_entry | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | Title : get_entry | ||||||||||||||||||||||||||||||||||||||||||
| 153 | Usage : $matrix->get_entry(); | ||||||||||||||||||||||||||||||||||||||||||
| 154 | Function: returns a particular entry | ||||||||||||||||||||||||||||||||||||||||||
| 155 | Returns : a float | ||||||||||||||||||||||||||||||||||||||||||
| 156 | Arguments: string id1, string id2 | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 217 | ▶ | sub get_entry { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_entry: called CC=4 SCAR=14.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 217 | my ($self,$row,$column) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 217 | ▶ | $row && $column || $self->throw("Need at least 2 ids"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$row and $column
MC/DC0%0/2
$row and $column
$row
$column
Truth table33%1/3
A and B
A= $rowB= $column
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 217 | my %matrix = %{$self->_matrix}; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 217 | my @values = @{$self->_values}; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 217 | ▶ | if(ref $matrix{$row}{$column}){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 217 | my ($i,$j) = @{$matrix{$row}{$column}}; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 217 | return $values[$i][$j]; | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | =head2 get_row | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | Title : get_row | ||||||||||||||||||||||||||||||||||||||||||
| 176 | Usage : $matrix->get_row('ALPHA'); | ||||||||||||||||||||||||||||||||||||||||||
| 177 | Function: returns a particular row | ||||||||||||||||||||||||||||||||||||||||||
| 178 | Returns : an array of float | ||||||||||||||||||||||||||||||||||||||||||
| 179 | Arguments: string id1 | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 4 | ▶ | sub get_row { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_row: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 4 | my ($self,$row) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 4 | ▶ | $row || $self->throw("Need at least a row id"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 4 | my %matrix = %{$self->_matrix}; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 4 | my @values = @{$self->_values}; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 4 | my @names = @{$self->names}; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 4 | ▶ | $matrix{$row} || return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 4 | my ($val) = values %{$matrix{$row}}; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 4 | my $row_pointer = $val->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 4 | my $index = scalar(@names)-1; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 4 | return @{$values[$row_pointer]}[0..$index]; | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | =head2 get_column | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | Title : get_column | ||||||||||||||||||||||||||||||||||||||||||
| 200 | Usage : $matrix->get_column('ALPHA'); | ||||||||||||||||||||||||||||||||||||||||||
| 201 | Function: returns a particular column | ||||||||||||||||||||||||||||||||||||||||||
| 202 | Returns : an array of floats | ||||||||||||||||||||||||||||||||||||||||||
| 203 | Arguments: string id1 | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 3 | ▶ | sub get_column { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_column: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 3 | my ($self,$column) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 3 | ▶ | $column || $self->throw("Need at least a column id"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 3 | my %matrix = %{$self->_matrix}; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 3 | my @values = @{$self->_values}; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 3 | my @names = @{$self->names}; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 3 | ▶ | $matrix{$column} || return (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 3 | my ($val) = values %{$matrix{$column}}; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 3 | my $row_pointer = $val->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 217 | 3 | my @ret; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 3 | ▶ | for(my $i=0; $i < scalar(@names); $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 49 | push @ret, $values[$i][$row_pointer]; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 3 | return @ret; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | =head2 get_diagonal | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | Title : get_diagonal | ||||||||||||||||||||||||||||||||||||||||||
| 227 | Usage : $matrix->get_diagonal(); | ||||||||||||||||||||||||||||||||||||||||||
| 228 | Function: returns the diagonal of the matrix | ||||||||||||||||||||||||||||||||||||||||||
| 229 | Returns : an array of float | ||||||||||||||||||||||||||||||||||||||||||
| 230 | Arguments: string id1 | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 3 | ▶ | sub get_diagonal { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_diagonal: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 3 | my %matrix = %{$self->_matrix}; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 3 | my @values = @{$self->_values}; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 3 | my @return; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 3 | foreach my $name (@{$self->names}){ | |||||||||||||||||||||||||||||||||||||||||
| 240 | 49 | my ($i,$j) = @{$matrix{$name}{$name}}; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 49 | push @return,$values[$i][$j]; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 3 | return @return; | |||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | =head2 print_matrix | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | Title : print_matrix | ||||||||||||||||||||||||||||||||||||||||||
| 249 | Usage : $matrix->print_matrix(); | ||||||||||||||||||||||||||||||||||||||||||
| 250 | Function: returns a string of the matrix in phylip format | ||||||||||||||||||||||||||||||||||||||||||
| 251 | Returns : a string | ||||||||||||||||||||||||||||||||||||||||||
| 252 | Arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 1 | ▶ | sub print_matrix { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_matrix: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 258 | 1 | my @names = @{$self->names}; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | my @values = @{$self->_values}; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 1 | my %matrix = %{$self->_matrix}; | |||||||||||||||||||||||||||||||||||||||||
| 261 | 1 | my $str; | |||||||||||||||||||||||||||||||||||||||||
| 262 | 1 | $str.= (" "x 4). scalar(@names)."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | foreach my $name (@names){ | |||||||||||||||||||||||||||||||||||||||||
| 264 | 5 | my $newname = $name. (" " x (15-length($name))); | |||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | if( length($name) >= 15 ) { $newname .= " " } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 5 | $str.=$newname; | |||||||||||||||||||||||||||||||||||||||||
| 267 | 5 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 5 | foreach my $n (@names) { | |||||||||||||||||||||||||||||||||||||||||
| 269 | 25 | my ($i,$j) = @{$matrix{$name}{$n}}; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 25 | ▶ | if($count < $#names){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 20 | $str .= $values[$i][$j]. " "; | |||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 5 | ▶ | if( ! defined $values[$i][$j] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | $self->debug("no value for $i,$j cell\n"); | |||||||||||||||||||||||||||||||||||||||||
| 276 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 5 | $str .= $values[$i][$j]; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 25 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 5 | $str.="\n"; | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 1 | return $str; | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | =head2 _matrix | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | Title : _matrix | ||||||||||||||||||||||||||||||||||||||||||
| 290 | Usage : $matrix->_matrix(); | ||||||||||||||||||||||||||||||||||||||||||
| 291 | Function: get/set for hash reference of the pointers | ||||||||||||||||||||||||||||||||||||||||||
| 292 | to the value matrix | ||||||||||||||||||||||||||||||||||||||||||
| 293 | Returns : hash reference | ||||||||||||||||||||||||||||||||||||||||||
| 294 | Arguments: hash reference | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 244 | ▶ | sub _matrix { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_matrix: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 244 | my ($self,$val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 244 | ▶ | if($val){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | 16 | $self->{'_matrix'} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 244 | return $self->{'_matrix'}; | |||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | =head2 names | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | Title : names | ||||||||||||||||||||||||||||||||||||||||||
| 310 | Usage : $matrix->names(); | ||||||||||||||||||||||||||||||||||||||||||
| 311 | Function: get/set for array ref of names of sequences | ||||||||||||||||||||||||||||||||||||||||||
| 312 | Returns : an array reference | ||||||||||||||||||||||||||||||||||||||||||
| 313 | Arguments: an array reference | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 30 | ▶ | sub names { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
names: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 30 | my ($self,$val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 319 | 30 | ▶ | if($val){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 16 | $self->{'_names'} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 30 | return $self->{'_names'}; | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | =head2 program | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | Title : program | ||||||||||||||||||||||||||||||||||||||||||
| 328 | Usage : $matrix->program(); | ||||||||||||||||||||||||||||||||||||||||||
| 329 | Function: get/set for the program name generating this | ||||||||||||||||||||||||||||||||||||||||||
| 330 | matrix | ||||||||||||||||||||||||||||||||||||||||||
| 331 | Returns : string | ||||||||||||||||||||||||||||||||||||||||||
| 332 | Arguments: string | ||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 1 | ▶ | sub program { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
program: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 1 | my ($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 338 | 1 | return $self->matrix_name(@_); | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | =head2 _values | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | Title : _values | ||||||||||||||||||||||||||||||||||||||||||
| 344 | Usage : $matrix->_values(); | ||||||||||||||||||||||||||||||||||||||||||
| 345 | Function: get/set for array ref of the matrix containing | ||||||||||||||||||||||||||||||||||||||||||
| 346 | distance values | ||||||||||||||||||||||||||||||||||||||||||
| 347 | Returns : an array reference | ||||||||||||||||||||||||||||||||||||||||||
| 348 | Arguments: an array reference | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | 244 | ▶ | sub _values { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_values: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | 244 | my ($self,$val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 354 | 244 | ▶ | if($val){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 16 | $self->{'_values'} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | 244 | return $self->{'_values'}; | |||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | =head1 L<Bio::Matrix::MatrixI> implementation | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | =head2 matrix_id | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | Title : matrix_id | ||||||||||||||||||||||||||||||||||||||||||
| 367 | Usage : my $id = $matrix->matrix_id | ||||||||||||||||||||||||||||||||||||||||||
| 368 | Function: Get/Set the matrix ID | ||||||||||||||||||||||||||||||||||||||||||
| 369 | Returns : scalar value | ||||||||||||||||||||||||||||||||||||||||||
| 370 | Args : [optional] new id value to store | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | sub matrix_id{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
matrix_id: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | return $self->{'_matid'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | return $self->{'_matid'}; | |||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | =head2 matrix_name | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | Title : matrix_name | ||||||||||||||||||||||||||||||||||||||||||
| 386 | Usage : my $name = $matrix->matrix_name(); | ||||||||||||||||||||||||||||||||||||||||||
| 387 | Function: Get/Set the matrix name | ||||||||||||||||||||||||||||||||||||||||||
| 388 | Returns : scalar value | ||||||||||||||||||||||||||||||||||||||||||
| 389 | Args : [optional] new matrix name value | ||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | 15 | ▶ | sub matrix_name{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
matrix_name: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 15 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 396 | 15 | ▶ | return $self->{'_matname'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 1 | return $self->{'_matname'}; | |||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | =head2 column_header | ||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | Title : column_header | ||||||||||||||||||||||||||||||||||||||||||
| 403 | Usage : my $name = $matrix->column_header(0) | ||||||||||||||||||||||||||||||||||||||||||
| 404 | Function: Gets the column header for a particular column number | ||||||||||||||||||||||||||||||||||||||||||
| 405 | Returns : string | ||||||||||||||||||||||||||||||||||||||||||
| 406 | Args : integer | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | sub column_header{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_header: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my ($self,$num) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | my @coln = $self->column_names; | |||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | return $coln[$num]; | |||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | =head2 row_header | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | Title : row_header | ||||||||||||||||||||||||||||||||||||||||||
| 421 | Usage : my $name = $matrix->row_header(0) | ||||||||||||||||||||||||||||||||||||||||||
| 422 | Function: Gets the row header for a particular row number | ||||||||||||||||||||||||||||||||||||||||||
| 423 | Returns : string | ||||||||||||||||||||||||||||||||||||||||||
| 424 | Args : integer | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | sub row_header{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
row_header: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my ($self,$num) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my @rown = $self->row_names; | |||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | return $rown[$num]; | |||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||
| 434 | =head2 column_num_for_name | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | Title : column_num_for_name | ||||||||||||||||||||||||||||||||||||||||||
| 437 | Usage : my $num = $matrix->column_num_for_name($name) | ||||||||||||||||||||||||||||||||||||||||||
| 438 | Function: Gets the column number for a particular column name | ||||||||||||||||||||||||||||||||||||||||||
| 439 | Returns : integer | ||||||||||||||||||||||||||||||||||||||||||
| 440 | Args : string | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | sub column_num_for_name{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_num_for_name: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | my ($self,$name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | my $ct = 0; | |||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | foreach my $n ( $self->column_names ) { | |||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | return $ct if $n eq $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | $ct++; | |||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | =head2 row_num_for_name | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | Title : row_num_for_name | ||||||||||||||||||||||||||||||||||||||||||
| 458 | Usage : my $num = $matrix->row_num_for_name($name) | ||||||||||||||||||||||||||||||||||||||||||
| 459 | Function: Gets the row number for a particular row name | ||||||||||||||||||||||||||||||||||||||||||
| 460 | Returns : integer | ||||||||||||||||||||||||||||||||||||||||||
| 461 | Args : string | ||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | sub row_num_for_name{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
row_num_for_name: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | my ($self,$name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | my $ct = 0; | |||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | foreach my $n ( $self->row_names ) { | |||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | return $ct if $n eq $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | $ct++; | |||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | =head2 num_rows | ||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | Title : num_rows | ||||||||||||||||||||||||||||||||||||||||||
| 478 | Usage : my $rowcount = $matrix->num_rows; | ||||||||||||||||||||||||||||||||||||||||||
| 479 | Function: Get the number of rows | ||||||||||||||||||||||||||||||||||||||||||
| 480 | Returns : integer | ||||||||||||||||||||||||||||||||||||||||||
| 481 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | sub num_rows{ return scalar @{shift->names} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
num_rows: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||
| 488 | =head2 num_columns | ||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | Title : num_columns | ||||||||||||||||||||||||||||||||||||||||||
| 491 | Usage : my $colcount = $matrix->num_columns | ||||||||||||||||||||||||||||||||||||||||||
| 492 | Function: Get the number of columns | ||||||||||||||||||||||||||||||||||||||||||
| 493 | Returns : integer | ||||||||||||||||||||||||||||||||||||||||||
| 494 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | sub num_columns{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
num_columns: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | return scalar @{shift->names}; | |||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | =head2 row_names | ||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | Title : row_names | ||||||||||||||||||||||||||||||||||||||||||
| 506 | Usage : my @rows = $matrix->row_names | ||||||||||||||||||||||||||||||||||||||||||
| 507 | Function: The names of all the rows | ||||||||||||||||||||||||||||||||||||||||||
| 508 | Returns : array in array context, arrayref in scalar context | ||||||||||||||||||||||||||||||||||||||||||
| 509 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | sub row_names{ return @{shift->names} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
row_names: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||
| 516 | =head2 column_names | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | Title : column_names | ||||||||||||||||||||||||||||||||||||||||||
| 519 | Usage : my @columns = $matrix->column_names | ||||||||||||||||||||||||||||||||||||||||||
| 520 | Function: The names of all the columns | ||||||||||||||||||||||||||||||||||||||||||
| 521 | Returns : array in array context, arrayref in scalar context | ||||||||||||||||||||||||||||||||||||||||||
| 522 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||
| 527 | 1 | ▶ | sub column_names{ return @{shift->names} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_names: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 528 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||