| 1 | package Bio::Phylo::Matrices::Matrix; | ||||||||||||||||||||||||||||
| 2 | 13 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 13 | ▶ | use base 'Bio::Phylo::Matrices::MatrixRole'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 13 | ▶ | use Bio::Phylo::Util::CONSTANT qw':objecttypes /looks_like/'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 13 | ▶ | use Bio::Phylo::Util::Exceptions qw'throw'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | { | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 13 | my $logger = __PACKAGE__->get_logger; | |||||||||||||||||||||||||||
| 10 | 13 | my @inside_out_arrays = \( | |||||||||||||||||||||||||||
| 11 | my ( | ||||||||||||||||||||||||||||
| 12 | %type, %charlabels, %statelabels, | ||||||||||||||||||||||||||||
| 13 | %gapmode, %matchchar, %polymorphism, | ||||||||||||||||||||||||||||
| 14 | %case_sensitivity, %characters, | ||||||||||||||||||||||||||||
| 15 | ) | ||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =head1 NAME | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | Bio::Phylo::Matrices::Matrix - Character state matrix | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | use Bio::Phylo::Factory; | ||||||||||||||||||||||||||||
| 25 | my $fac = Bio::Phylo::Factory->new; | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | # instantiate taxa object | ||||||||||||||||||||||||||||
| 28 | my $taxa = $fac->create_taxa; | ||||||||||||||||||||||||||||
| 29 | for ( 'Homo sapiens', 'Pan paniscus', 'Pan troglodytes' ) { | ||||||||||||||||||||||||||||
| 30 | $taxa->insert( $fac->create_taxon( '-name' => $_ ) ); | ||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # instantiate matrix object, 'standard' data type. All categorical | ||||||||||||||||||||||||||||
| 34 | # data types follow semantics like this, though with different | ||||||||||||||||||||||||||||
| 35 | # symbols in lookup table and matrix | ||||||||||||||||||||||||||||
| 36 | my $standard_matrix = $fac->create_matrix( | ||||||||||||||||||||||||||||
| 37 | '-type' => 'STANDARD', | ||||||||||||||||||||||||||||
| 38 | '-taxa' => $taxa, | ||||||||||||||||||||||||||||
| 39 | '-lookup' => { | ||||||||||||||||||||||||||||
| 40 | '-' => [], | ||||||||||||||||||||||||||||
| 41 | '0' => [ '0' ], | ||||||||||||||||||||||||||||
| 42 | '1' => [ '1' ], | ||||||||||||||||||||||||||||
| 43 | '?' => [ '0', '1' ], | ||||||||||||||||||||||||||||
| 44 | }, | ||||||||||||||||||||||||||||
| 45 | '-charlabels' => [ 'Opposable big toes', 'Opposable thumbs', 'Not a pygmy' ], | ||||||||||||||||||||||||||||
| 46 | '-matrix' => [ | ||||||||||||||||||||||||||||
| 47 | [ 'Homo sapiens' => '0', '1', '1' ], | ||||||||||||||||||||||||||||
| 48 | [ 'Pan paniscus' => '1', '1', '0' ], | ||||||||||||||||||||||||||||
| 49 | [ 'Pan troglodytes' => '1', '1', '1' ], | ||||||||||||||||||||||||||||
| 50 | ], | ||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | # note: complicated constructor for mixed data! | ||||||||||||||||||||||||||||
| 54 | my $mixed_matrix = Bio::Phylo::Matrices::Matrix->new( | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | # if you want to create 'mixed', value for '-type' is array ref... | ||||||||||||||||||||||||||||
| 57 | '-type' => [ | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | # ...with first field 'mixed'... | ||||||||||||||||||||||||||||
| 60 | 'mixed', | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | # ...second field is an array ref... | ||||||||||||||||||||||||||||
| 63 | [ | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | # ...with _ordered_ key/value pairs... | ||||||||||||||||||||||||||||
| 66 | 'dna' => 10, # value is length of type range | ||||||||||||||||||||||||||||
| 67 | 'standard' => 10, # value is length of type range | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | # ... or, more complicated, value is a hash ref... | ||||||||||||||||||||||||||||
| 70 | 'rna' => { | ||||||||||||||||||||||||||||
| 71 | '-length' => 10, # value is length of type range | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | # ...value for '-args' is an array ref with args | ||||||||||||||||||||||||||||
| 74 | # as can be passed to 'unmixed' datatype constructors, | ||||||||||||||||||||||||||||
| 75 | # for example, here we modify the lookup table for | ||||||||||||||||||||||||||||
| 76 | # rna to allow both 'U' (default) and 'T' | ||||||||||||||||||||||||||||
| 77 | '-args' => [ | ||||||||||||||||||||||||||||
| 78 | '-lookup' => { | ||||||||||||||||||||||||||||
| 79 | 'A' => [ 'A' ], | ||||||||||||||||||||||||||||
| 80 | 'C' => [ 'C' ], | ||||||||||||||||||||||||||||
| 81 | 'G' => [ 'G' ], | ||||||||||||||||||||||||||||
| 82 | 'U' => [ 'U' ], | ||||||||||||||||||||||||||||
| 83 | 'T' => [ 'T' ], | ||||||||||||||||||||||||||||
| 84 | 'M' => [ 'A', 'C' ], | ||||||||||||||||||||||||||||
| 85 | 'R' => [ 'A', 'G' ], | ||||||||||||||||||||||||||||
| 86 | 'S' => [ 'C', 'G' ], | ||||||||||||||||||||||||||||
| 87 | 'W' => [ 'A', 'U', 'T' ], | ||||||||||||||||||||||||||||
| 88 | 'Y' => [ 'C', 'U', 'T' ], | ||||||||||||||||||||||||||||
| 89 | 'K' => [ 'G', 'U', 'T' ], | ||||||||||||||||||||||||||||
| 90 | 'V' => [ 'A', 'C', 'G' ], | ||||||||||||||||||||||||||||
| 91 | 'H' => [ 'A', 'C', 'U', 'T' ], | ||||||||||||||||||||||||||||
| 92 | 'D' => [ 'A', 'G', 'U', 'T' ], | ||||||||||||||||||||||||||||
| 93 | 'B' => [ 'C', 'G', 'U', 'T' ], | ||||||||||||||||||||||||||||
| 94 | 'X' => [ 'G', 'A', 'U', 'T', 'C' ], | ||||||||||||||||||||||||||||
| 95 | 'N' => [ 'G', 'A', 'U', 'T', 'C' ], | ||||||||||||||||||||||||||||
| 96 | }, | ||||||||||||||||||||||||||||
| 97 | ], | ||||||||||||||||||||||||||||
| 98 | }, | ||||||||||||||||||||||||||||
| 99 | ], | ||||||||||||||||||||||||||||
| 100 | ], | ||||||||||||||||||||||||||||
| 101 | ); | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | # prints 'mixed(Dna:1-10, Standard:11-20, Rna:21-30)' | ||||||||||||||||||||||||||||
| 104 | print $mixed_matrix->get_type; | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | This module defines a container object that holds | ||||||||||||||||||||||||||||
| 109 | L<Bio::Phylo::Matrices::Datum> objects. The matrix | ||||||||||||||||||||||||||||
| 110 | object inherits from L<Bio::Phylo::MatrixRole>, so the | ||||||||||||||||||||||||||||
| 111 | methods defined there apply here. | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | =head1 METHODS | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | =head2 MUTATORS | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | =over | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | =item set_statelabels() | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | Sets argument state labels. | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | Type : Mutator | ||||||||||||||||||||||||||||
| 124 | Title : set_statelabels | ||||||||||||||||||||||||||||
| 125 | Usage : $matrix->set_statelabels( [ [ 'state1', 'state2' ] ] ); | ||||||||||||||||||||||||||||
| 126 | Function: Assigns state labels. | ||||||||||||||||||||||||||||
| 127 | Returns : $self | ||||||||||||||||||||||||||||
| 128 | Args : ARRAY, or nothing (to reset); | ||||||||||||||||||||||||||||
| 129 | The array is two-dimensional, | ||||||||||||||||||||||||||||
| 130 | the first index is to indicate | ||||||||||||||||||||||||||||
| 131 | the column the labels apply to, | ||||||||||||||||||||||||||||
| 132 | the second dimension the states | ||||||||||||||||||||||||||||
| 133 | (sorted numerically or alphabetically, | ||||||||||||||||||||||||||||
| 134 | depending on what's appropriate) | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | =cut | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 7 | ▶ | sub set_statelabels : Clonable { | ||||||||||||||||||||||||||
|
Subroutine
set_statelabels: called CC=7 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||
| 139 | 7 | my ( $self, $statelabels ) = @_; | |||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | # it's an array ref, but what about its contents? | ||||||||||||||||||||||||||||
| 142 | 7 | ▶ | if ( looks_like_instance( $statelabels, 'ARRAY' ) ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 143 | 7 | for my $col ( @{$statelabels} ) { | |||||||||||||||||||||||||||
| 144 | 2 | ▶ | if ( not looks_like_instance( $col, 'ARRAY' ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 145 | 0 | throw 'BadArgs' => | |||||||||||||||||||||||||||
| 146 | "statelabels must be a two dimensional array ref"; | ||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | # it's defined but not an array ref | ||||||||||||||||||||||||||||
| 152 | ▶ | elsif ( defined $statelabels | |||||||||||||||||||||||||||
|
Condition0%0/3
defined $statelabels and not &looks_like_instance($statelabels, "ARRAY")
MC/DC0%0/2
defined $statelabels and not &looks_like_instance($statelabels, "ARRAY")
defined $statelabels
not &looks_like_instance($statelabels, "ARRAY")
Truth table0%0/3
A and not(B)
A= defined $statelabelsB= not &looks_like_instance($statelabels, "ARRAY")
| |||||||||||||||||||||||||||||
| 153 | && !looks_like_instance( $statelabels, 'ARRAY' ) ) | ||||||||||||||||||||||||||||
| 154 | { | ||||||||||||||||||||||||||||
| 155 | 0 | throw 'BadArgs' => | |||||||||||||||||||||||||||
| 156 | "statelabels must be a two dimensional array ref"; | ||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | # it's either a valid array ref, or nothing, i.e. a reset | ||||||||||||||||||||||||||||
| 160 | 7 | ▶ | $statelabels{ $self->get_id } = $statelabels || []; | ||||||||||||||||||||||||||
|
Condition50%1/2
$statelabels || []
MC/DC0%0/1
$statelabels || []
$statelabels
Truth table50%1/2
A
A= $statelabels
| |||||||||||||||||||||||||||||
| 161 | 7 | return $self; | |||||||||||||||||||||||||||
| 162 | 13 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | =item set_characters() | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | Sets the character set manager object Bio::Phylo::Matrices::Characters. | ||||||||||||||||||||||||||||
| 167 | Normally you never have to use this. | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | Type : Mutator | ||||||||||||||||||||||||||||
| 170 | Title : set_characters | ||||||||||||||||||||||||||||
| 171 | Usage : $matrix->set_characters( $characters ); | ||||||||||||||||||||||||||||
| 172 | Function: Assigns Bio::Phylo::Matrices::Characters object | ||||||||||||||||||||||||||||
| 173 | Returns : $self | ||||||||||||||||||||||||||||
| 174 | Args : Bio::Phylo::Matrices::Characters | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =cut | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 44 | ▶ | sub set_characters : Clonable DeepClonable { | ||||||||||||||||||||||||||
|
Subroutine
set_characters: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 179 | 44 | my ( $self, $characters ) = @_; | |||||||||||||||||||||||||||
| 180 | 44 | ▶ | if ( looks_like_object $characters, _CHARACTERS_ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | 44 | $characters{ $self->get_id } = $characters; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | 44 | return $self; | |||||||||||||||||||||||||||
| 184 | 13 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | =item set_gapmode() | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | Defines matrix gapmode. | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | Type : Mutator | ||||||||||||||||||||||||||||
| 191 | Title : set_gapmode | ||||||||||||||||||||||||||||
| 192 | Usage : $matrix->set_gapmode( 1 ); | ||||||||||||||||||||||||||||
| 193 | Function: Defines matrix gapmode ( false = missing, true = fifth state ) | ||||||||||||||||||||||||||||
| 194 | Returns : $self | ||||||||||||||||||||||||||||
| 195 | Args : boolean | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | =cut | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 6 | ▶ | sub set_gapmode : Clonable { | ||||||||||||||||||||||||||
|
Subroutine
set_gapmode: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 200 | 6 | my ( $self, $gapmode ) = @_; | |||||||||||||||||||||||||||
| 201 | 6 | $gapmode{ $self->get_id } = $gapmode; | |||||||||||||||||||||||||||
| 202 | 6 | return $self; | |||||||||||||||||||||||||||
| 203 | 13 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | =item set_matchchar() | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | Assigns match symbol. | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | Type : Mutator | ||||||||||||||||||||||||||||
| 210 | Title : set_matchchar | ||||||||||||||||||||||||||||
| 211 | Usage : $matrix->set_matchchar( $match ); | ||||||||||||||||||||||||||||
| 212 | Function: Assigns match symbol (default is '.'). | ||||||||||||||||||||||||||||
| 213 | Returns : $self | ||||||||||||||||||||||||||||
| 214 | Args : ARRAY | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | =cut | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 6 | ▶ | sub set_matchchar : Clonable { | ||||||||||||||||||||||||||
|
Subroutine
set_matchchar: called CC=4 SCAR=22.2
Pod
documented
| |||||||||||||||||||||||||||||
| 219 | 6 | my ( $self, $match ) = @_; | |||||||||||||||||||||||||||
| 220 | 6 | ▶ | if ( $match ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 0 | my $missing = $self->get_missing; | |||||||||||||||||||||||||||
| 222 | 0 | my $gap = $self->get_gap; | |||||||||||||||||||||||||||
| 223 | 0 | ▶ | if ( $match eq $missing ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 224 | 0 | throw 'BadArgs' => | |||||||||||||||||||||||||||
| 225 | "Match character '$match' already in use as missing character"; | ||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | elsif ( $match eq $gap ) { | ||||||||||||||||||||||||||||
| 228 | 0 | throw 'BadArgs' => | |||||||||||||||||||||||||||
| 229 | "Match character '$match' already in use as gap character"; | ||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | else { | ||||||||||||||||||||||||||||
| 232 | 0 | $matchchar{ $self->get_id } = $match; | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | else { | ||||||||||||||||||||||||||||
| 236 | 6 | $matchchar{ $self->get_id } = undef; | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | 6 | return $self; | |||||||||||||||||||||||||||
| 239 | 13 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | =item set_polymorphism() | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | Defines matrix 'polymorphism' interpretation. | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | Type : Mutator | ||||||||||||||||||||||||||||
| 246 | Title : set_polymorphism | ||||||||||||||||||||||||||||
| 247 | Usage : $matrix->set_polymorphism( 1 ); | ||||||||||||||||||||||||||||
| 248 | Function: Defines matrix 'polymorphism' interpretation | ||||||||||||||||||||||||||||
| 249 | ( false = uncertainty, true = polymorphism ) | ||||||||||||||||||||||||||||
| 250 | Returns : $self | ||||||||||||||||||||||||||||
| 251 | Args : boolean | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | =cut | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 6 | ▶ | sub set_polymorphism : Clonable { | ||||||||||||||||||||||||||
|
Subroutine
set_polymorphism: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||
| 256 | 6 | my ( $self, $poly ) = @_; | |||||||||||||||||||||||||||
| 257 | 6 | ▶ | if ( defined $poly ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | 0 | $polymorphism{ $self->get_id } = $poly; | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | else { | ||||||||||||||||||||||||||||
| 261 | 6 | delete $polymorphism{ $self->get_id }; | |||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | 6 | return $self; | |||||||||||||||||||||||||||
| 264 | 13 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =item set_respectcase() | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | Defines matrix case sensitivity interpretation. | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | Type : Mutator | ||||||||||||||||||||||||||||
| 271 | Title : set_respectcase | ||||||||||||||||||||||||||||
| 272 | Usage : $matrix->set_respectcase( 1 ); | ||||||||||||||||||||||||||||
| 273 | Function: Defines matrix case sensitivity interpretation | ||||||||||||||||||||||||||||
| 274 | ( false = disregarded, true = "respectcase" ) | ||||||||||||||||||||||||||||
| 275 | Returns : $self | ||||||||||||||||||||||||||||
| 276 | Args : boolean | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | =cut | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | 6 | ▶ | sub set_respectcase : Clonable { | ||||||||||||||||||||||||||
|
Subroutine
set_respectcase: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||
| 281 | 6 | my ( $self, $case_sensitivity ) = @_; | |||||||||||||||||||||||||||
| 282 | 6 | ▶ | if ( defined $case_sensitivity ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 283 | 0 | $case_sensitivity{ $self->get_id } = $case_sensitivity; | |||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | else { | ||||||||||||||||||||||||||||
| 286 | 6 | delete $case_sensitivity{ $self->get_id }; | |||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||
| 288 | 6 | return $self; | |||||||||||||||||||||||||||
| 289 | 13 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | =back | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | =head2 ACCESSORS | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | =over | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | =item get_characters() | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | Retrieves characters object. | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | Type : Accessor | ||||||||||||||||||||||||||||
| 302 | Title : get_characters | ||||||||||||||||||||||||||||
| 303 | Usage : my $characters = $matrix->get_characters | ||||||||||||||||||||||||||||
| 304 | Function: Retrieves characters object. | ||||||||||||||||||||||||||||
| 305 | Returns : Bio::Phylo::Matrices::Characters | ||||||||||||||||||||||||||||
| 306 | Args : None. | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | =cut | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | 169 | ▶ | sub get_characters { | ||||||||||||||||||||||||||
|
Subroutine
get_characters: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 311 | 169 | my $self = shift; | |||||||||||||||||||||||||||
| 312 | 169 | return $characters{ $self->get_id }; | |||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | =item get_statelabels() | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | Retrieves state labels. | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | Type : Accessor | ||||||||||||||||||||||||||||
| 320 | Title : get_statelabels | ||||||||||||||||||||||||||||
| 321 | Usage : my @statelabels = @{ $matrix->get_statelabels }; | ||||||||||||||||||||||||||||
| 322 | Function: Retrieves state labels. | ||||||||||||||||||||||||||||
| 323 | Returns : ARRAY | ||||||||||||||||||||||||||||
| 324 | Args : None. | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | =cut | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | 7 | ▶ | sub get_statelabels { $statelabels{ $_[0]->get_id } || [] } | ||||||||||||||||||||||||||
|
Subroutine
get_statelabels: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | =item get_gapmode() | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | Returns matrix gapmode. | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | Type : Accessor | ||||||||||||||||||||||||||||
| 335 | Title : get_gapmode | ||||||||||||||||||||||||||||
| 336 | Usage : do_something() if $matrix->get_gapmode; | ||||||||||||||||||||||||||||
| 337 | Function: Returns matrix gapmode ( false = missing, true = fifth state ) | ||||||||||||||||||||||||||||
| 338 | Returns : boolean | ||||||||||||||||||||||||||||
| 339 | Args : none | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | =cut | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | 6 | ▶ | sub get_gapmode { $gapmode{ $_[0]->get_id } } | ||||||||||||||||||||||||||
|
Subroutine
get_gapmode: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | =item get_matchchar() | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | Returns matrix match character. | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | Type : Accessor | ||||||||||||||||||||||||||||
| 350 | Title : get_matchchar | ||||||||||||||||||||||||||||
| 351 | Usage : my $char = $matrix->get_matchchar; | ||||||||||||||||||||||||||||
| 352 | Function: Returns matrix match character (default is '.') | ||||||||||||||||||||||||||||
| 353 | Returns : SCALAR | ||||||||||||||||||||||||||||
| 354 | Args : none | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | =cut | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | 25 | ▶ | sub get_matchchar { $matchchar{ $_[0]->get_id } } | ||||||||||||||||||||||||||
|
Subroutine
get_matchchar: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | =item get_polymorphism() | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | Returns matrix 'polymorphism' interpretation. | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | Type : Accessor | ||||||||||||||||||||||||||||
| 365 | Title : get_polymorphism | ||||||||||||||||||||||||||||
| 366 | Usage : do_something() if $matrix->get_polymorphism; | ||||||||||||||||||||||||||||
| 367 | Function: Returns matrix 'polymorphism' interpretation | ||||||||||||||||||||||||||||
| 368 | ( false = uncertainty, true = polymorphism ) | ||||||||||||||||||||||||||||
| 369 | Returns : boolean | ||||||||||||||||||||||||||||
| 370 | Args : none | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | =cut | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | 6 | ▶ | sub get_polymorphism { $polymorphism{ shift->get_id } } | ||||||||||||||||||||||||||
|
Subroutine
get_polymorphism: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | =item get_respectcase() | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | Returns matrix case sensitivity interpretation. | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | Type : Accessor | ||||||||||||||||||||||||||||
| 381 | Title : get_respectcase | ||||||||||||||||||||||||||||
| 382 | Usage : do_something() if $matrix->get_respectcase; | ||||||||||||||||||||||||||||
| 383 | Function: Returns matrix case sensitivity interpretation | ||||||||||||||||||||||||||||
| 384 | ( false = disregarded, true = "respectcase" ) | ||||||||||||||||||||||||||||
| 385 | Returns : boolean | ||||||||||||||||||||||||||||
| 386 | Args : none | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | =cut | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | 6 | ▶ | sub get_respectcase { $case_sensitivity{ shift->get_id } } | ||||||||||||||||||||||||||
|
Subroutine
get_respectcase: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | 39 | ▶ | sub _cleanup : Destructor { | ||||||||||||||||||||||||||
|
Subroutine
_cleanup: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 393 | 39 | my $self = shift; | |||||||||||||||||||||||||||
| 394 | 39 | my $id = $self->get_id; | |||||||||||||||||||||||||||
| 395 | 39 | for (@inside_out_arrays) { | |||||||||||||||||||||||||||
| 396 | 312 | ▶ | delete $_->{$id} if defined $id and exists $_->{$id}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $id and exists $_->{$id}
MC/DC50%1/2
defined $id and exists $_->{$id}
defined $id
exists $_->{$id}
Truth table66%2/3
A and B
A= defined $idB= exists $_->{$id}
| |||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||
| 398 | 13 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | =back | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | =cut | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | # podinherit_insert_token | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo> | ||||||||||||||||||||||||||||
| 409 | for any user or developer questions and discussions. | ||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | =over | ||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | =item L<Bio::Phylo::Taxa::TaxaLinker> | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | This object inherits from L<Bio::Phylo::Taxa::TaxaLinker>, so the | ||||||||||||||||||||||||||||
| 416 | methods defined therein are also applicable to L<Bio::Phylo::Matrices::Matrix> | ||||||||||||||||||||||||||||
| 417 | objects. | ||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | =item L<Bio::Phylo::Matrices::TypeSafeData> | ||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | This object inherits from L<Bio::Phylo::Matrices::TypeSafeData>, so the | ||||||||||||||||||||||||||||
| 422 | methods defined therein are also applicable to L<Bio::Phylo::Matrices::Matrix> | ||||||||||||||||||||||||||||
| 423 | objects. | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | =item L<Bio::Phylo::Manual> | ||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | Also see the manual: L<Bio::Phylo::Manual> and L<http://rutgervos.blogspot.com>. | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | =back | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | =head1 CITATION | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | If you use Bio::Phylo in published research, please cite it: | ||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | B<Rutger A Vos>, B<Jason Caravas>, B<Klaas Hartmann>, B<Mark A Jensen> | ||||||||||||||||||||||||||||
| 436 | and B<Chase Miller>, 2011. Bio::Phylo - phyloinformatic analysis using Perl. | ||||||||||||||||||||||||||||
| 437 | I<BMC Bioinformatics> B<12>:63. | ||||||||||||||||||||||||||||
| 438 | L<http://dx.doi.org/10.1186/1471-2105-12-63> | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | =cut | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||
| 443 | 13 | 1; | |||||||||||||||||||||||||||