| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::Tools::Phylo::Molphy::Result | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # Cared for by Jason Stajich <jason@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # Copyright Jason Stajich | ||||||||||||||||||||||||||||||||||||||||||
| 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::Tools::Phylo::Molphy::Result - container for data parsed from a ProtML run | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | # do not use this object directly, you will get it back as part of a | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # Molphy parser | ||||||||||||||||||||||||||||||||||||||||||
| 22 | use Bio::Tools::Phylo::Molphy; | ||||||||||||||||||||||||||||||||||||||||||
| 23 | my $parser = Bio::Tools::Phylo::Molphy->new(-file => 'output.protml'); | ||||||||||||||||||||||||||||||||||||||||||
| 24 | while( my $r = $parser->next_result ) { | ||||||||||||||||||||||||||||||||||||||||||
| 25 | # r is a Bio::Tools::Phylo::Molphy::Result object | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | # print the model name | ||||||||||||||||||||||||||||||||||||||||||
| 28 | print $r->model, "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | # get the substitution matrix | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # this is a hash of 3letter aa codes -> 3letter aa codes representing | ||||||||||||||||||||||||||||||||||||||||||
| 32 | # substitution rate | ||||||||||||||||||||||||||||||||||||||||||
| 33 | my $smat = $r->substitution_matrix; | ||||||||||||||||||||||||||||||||||||||||||
| 34 | print "Arg -> Gln substitution rate is %d\n", | ||||||||||||||||||||||||||||||||||||||||||
| 35 | $smat->{'Arg'}->{'Gln'}, "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | # get the transition probablity matrix | ||||||||||||||||||||||||||||||||||||||||||
| 38 | # this is a hash of 3letter aa codes -> 3letter aa codes representing | ||||||||||||||||||||||||||||||||||||||||||
| 39 | # transition probabilty | ||||||||||||||||||||||||||||||||||||||||||
| 40 | my $tmat = $r->transition_probability_matrix; | ||||||||||||||||||||||||||||||||||||||||||
| 41 | print "Arg -> Gln transition probablity is %.2f\n", | ||||||||||||||||||||||||||||||||||||||||||
| 42 | $tmat->{'Arg'}->{'Gln'}, "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | # get the frequency for each of the residues | ||||||||||||||||||||||||||||||||||||||||||
| 45 | my $rfreqs = $r->residue_frequencies; | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | foreach my $residue ( keys %{$rfreqs} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 48 | printf "residue %s expected freq: %.2f observed freq: %.2f\n", | ||||||||||||||||||||||||||||||||||||||||||
| 49 | $residue,$rfreqs->{$residue}->[0], $rfreqs->{$residue}->[1]; | ||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | my @trees; | ||||||||||||||||||||||||||||||||||||||||||
| 53 | while( my $t = $r->next_tree ) { | ||||||||||||||||||||||||||||||||||||||||||
| 54 | push @trees, $t; | ||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | print "search space is ", $r->search_space, "\n", | ||||||||||||||||||||||||||||||||||||||||||
| 58 | "1st tree score is ", $trees[0]->score, "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | # writing to STDOUT, use -file => '>filename' to specify a file | ||||||||||||||||||||||||||||||||||||||||||
| 61 | my $out = Bio::TreeIO->new(-format => "newick"); | ||||||||||||||||||||||||||||||||||||||||||
| 62 | $out->write_tree($trees[0]); # writing only the 1st tree | ||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | A container for data parsed from a ProtML run. | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||
| 76 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||||||||||||||||
| 77 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||
| 80 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||
| 89 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||
| 90 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||
| 91 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||
| 96 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||
| 97 | web: | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | =head1 AUTHOR - Jason Stajich | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | Email jason-at-bioperl.org | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||
| 108 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | package Bio::Tools::Phylo::Molphy::Result; | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 3 | $Bio::Tools::Phylo::Molphy::Result::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | # Object preamble - inherits from Bio::Root::Root | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 3 | ▶ | use base qw(Bio::Root::Root); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | Title : new | ||||||||||||||||||||||||||||||||||||||||||
| 129 | Usage : my $obj = Bio::Tools::Phylo::Molphy::Result->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 130 | Function: Builds a new Bio::Tools::Phylo::Molphy::Result object | ||||||||||||||||||||||||||||||||||||||||||
| 131 | Returns : Bio::Tools::Phylo::Molphy::Result | ||||||||||||||||||||||||||||||||||||||||||
| 132 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 2 | my($class,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 2 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | my ($trees,$smat,$freq, | |||||||||||||||||||||||||||||||||||||||||
| 142 | $model, $sspace, | ||||||||||||||||||||||||||||||||||||||||||
| 143 | ) = $self->_rearrange([qw(TREES SUBSTITUTION_MATRIX | ||||||||||||||||||||||||||||||||||||||||||
| 144 | FREQUENCIES | ||||||||||||||||||||||||||||||||||||||||||
| 145 | MODEL SEARCH_SPACE)], @args); | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 2 | ▶ | if( $trees ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 2 | ▶ | if(ref($trees) !~ /ARRAY/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $self->warn("Must provide a valid array reference to initialize trees"); | |||||||||||||||||||||||||||||||||||||||||
| 150 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | foreach my $t ( @$trees ) { | |||||||||||||||||||||||||||||||||||||||||
| 152 | 10 | $self->add_tree($t); | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | # initialize things through object methods to be a good | ||||||||||||||||||||||||||||||||||||||||||
| 157 | # little OO programmer | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 2 | ▶ | if( ref($smat) =~ /HASH/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 2 | $self->substitution_matrix($smat); | |||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 2 | ▶ | if( ref($freq) =~ /HASH/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 2 | $self->residue_frequencies($freq); | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 2 | ▶ | $model && $self->model($model); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 2 | ▶ | $sspace && $self->search_space($sspace); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 2 | $self->{'_treeiterator'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | =head2 model | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | Title : model | ||||||||||||||||||||||||||||||||||||||||||
| 175 | Usage : $obj->model($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 176 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 177 | Returns : value of model | ||||||||||||||||||||||||||||||||||||||||||
| 178 | Args : newvalue (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 4 | ▶ | sub model{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
model: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 4 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 4 | ▶ | if( defined $value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 2 | $self->{'model'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 4 | return $self->{'model'}; | |||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | =head2 substitution_matrix | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | Title : substitution_matrix | ||||||||||||||||||||||||||||||||||||||||||
| 195 | Usage : my $smat = $result->subsitution_matrix; | ||||||||||||||||||||||||||||||||||||||||||
| 196 | Function: Get the relative substitution matrix calculated in the ML procedure | ||||||||||||||||||||||||||||||||||||||||||
| 197 | Returns : reference to hash of hashes where key is the aa/nt name and value | ||||||||||||||||||||||||||||||||||||||||||
| 198 | is another hash ref which contains keys for all the aa/nt | ||||||||||||||||||||||||||||||||||||||||||
| 199 | possibilities | ||||||||||||||||||||||||||||||||||||||||||
| 200 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 3 | ▶ | sub substitution_matrix{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
substitution_matrix: called CC=5 SCAR=17.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 3 | my ($self,$val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 3 | ▶ | if(defined $val ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 2 | ▶ | if( ref($val) =~ /HASH/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 2 | foreach my $v (values %{$val} ) { | |||||||||||||||||||||||||||||||||||||||||
| 210 | 20 | ▶ | if( ref($v) !~ /HASH/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $self->warn("Must be a valid hashref of hashrefs for substition_matrix"); | |||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | $self->{'_substitution_matrix'} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 216 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | $self->warn("Must be a valid hashref of hashrefs for substition_matrix"); | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 3 | return $self->{'_substitution_matrix'}; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | =head2 transition_probability_matrix | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | Title : transition_probability_matrix | ||||||||||||||||||||||||||||||||||||||||||
| 227 | Usage : my $matrixref = $molphy->transition_probablity_matrix(); | ||||||||||||||||||||||||||||||||||||||||||
| 228 | Function: Gets the observed transition probability matrix | ||||||||||||||||||||||||||||||||||||||||||
| 229 | Returns : hash of hashes of aa/nt transition to each other aa/nt | ||||||||||||||||||||||||||||||||||||||||||
| 230 | Args : Transition matrix type, typically | ||||||||||||||||||||||||||||||||||||||||||
| 231 | '1PAM-1.0e05' or '1PAM-1.0e07' | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 3 | ▶ | sub transition_probability_matrix { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transition_probability_matrix: called CC=6 SCAR=19.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 3 | my ($self,$type,$val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 3 | ▶ | $type = '1PAM-1.0e7' unless defined $type; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 3 | ▶ | if(defined $val ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 2 | ▶ | if( ref($val) =~ /HASH/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | 2 | foreach my $v (values %{$val} ) { | |||||||||||||||||||||||||||||||||||||||||
| 242 | 40 | ▶ | if( ref($v) !~ /HASH/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $self->warn("Must be a valid hashref of hashrefs for transition_probability_matrix"); | |||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 2 | $self->{'_TPM'}->{$type} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 248 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $self->warn("Must be a valid hashref of hashrefs for transition_probablity_matrix"); | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | # fix this for nucml where there are 2 values (one is just a transformation | ||||||||||||||||||||||||||||||||||||||||||
| 255 | # of the either, but how to represent?) | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 3 | return $self->{'_TPM'}->{$type}; | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | =head2 residue_frequencies | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | Title : residue_frequencies | ||||||||||||||||||||||||||||||||||||||||||
| 262 | Usage : my %data = $molphy->residue_frequencies() | ||||||||||||||||||||||||||||||||||||||||||
| 263 | Function: Get the modeled and expected frequencies for | ||||||||||||||||||||||||||||||||||||||||||
| 264 | each of the residues in the sequence | ||||||||||||||||||||||||||||||||||||||||||
| 265 | Returns : hash of either aa (protml) or nt (nucml) frequencies | ||||||||||||||||||||||||||||||||||||||||||
| 266 | each key will point to an array reference where | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 1st slot is model's expected frequency | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 2nd slot is observed frequency in the data | ||||||||||||||||||||||||||||||||||||||||||
| 269 | $hash{'A'}->[0] = | ||||||||||||||||||||||||||||||||||||||||||
| 270 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | #' | ||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 3 | ▶ | sub residue_frequencies { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
residue_frequencies: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 3 | my ($self,$val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 3 | ▶ | if(defined $val ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | 2 | ▶ | if( ref($val) =~ /HASH/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 2 | $self->{'_residue_frequencies'} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 282 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $self->warn("Must be a valid hashref of hashrefs for residue_frequencies"); | |||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 3 | return %{$self->{'_residue_frequencies'}}; | |||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | =head2 next_tree | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | Title : next_tree | ||||||||||||||||||||||||||||||||||||||||||
| 292 | Usage : my $tree = $factory->next_tree; | ||||||||||||||||||||||||||||||||||||||||||
| 293 | Function: Get the next tree from the factory | ||||||||||||||||||||||||||||||||||||||||||
| 294 | Returns : L<Bio::Tree::TreeI> | ||||||||||||||||||||||||||||||||||||||||||
| 295 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 12 | ▶ | sub next_tree{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_tree: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | 12 | my ($self,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 301 | 12 | ▶ | return $self->{'_trees'}->[$self->{'_treeiterator'}++] || undef; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'_trees'}[$self->{'_treeiterator'}++] || undef
MC/DC100%1/1
$self->{'_trees'}[$self->{'_treeiterator'}++] || undef
$self->{'_trees'}[$self->{'_treeiterator'}++]
Truth table100%2/2
A
A= $self->{'_trees'}[$self->{'_treeiterator'}++]
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | =head2 rewind_tree | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | Title : rewind_tree_iterator | ||||||||||||||||||||||||||||||||||||||||||
| 307 | Usage : $result->rewind_tree() | ||||||||||||||||||||||||||||||||||||||||||
| 308 | Function: Rewinds the tree iterator so that next_tree can be | ||||||||||||||||||||||||||||||||||||||||||
| 309 | called again from the beginning | ||||||||||||||||||||||||||||||||||||||||||
| 310 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 311 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | sub rewind_tree_iterator { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rewind_tree_iterator: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | shift->{'_treeiterator'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | =head2 add_tree | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | Title : add_tree | ||||||||||||||||||||||||||||||||||||||||||
| 322 | Usage : $result->add_tree($tree); | ||||||||||||||||||||||||||||||||||||||||||
| 323 | Function: Adds a tree | ||||||||||||||||||||||||||||||||||||||||||
| 324 | Returns : integer which is the number of trees stored | ||||||||||||||||||||||||||||||||||||||||||
| 325 | Args : L<Bio::Tree::TreeI> | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 10 | ▶ | sub add_tree{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_tree: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 10 | my ($self,$tree) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 331 | 10 | ▶ | if( $tree && ref($tree) && $tree->isa('Bio::Tree::TreeI') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$tree and ref $tree and $tree->isa("Bio::Tree::TreeI")
$tree and ref $tree
MC/DC0%0/3
$tree and ref $tree and $tree->isa("Bio::Tree::TreeI")
$tree
ref $tree
$tree->isa("Bio::Tree::TreeI")
Truth table25%1/4
A and B and C
A= $treeB= ref $treeC= $tree->isa("Bio::Tree::TreeI")
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 10 | push @{$self->{'_trees'}},$tree; | |||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 10 | return scalar @{$self->{'_trees'}}; | |||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | =head2 search_space | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | Title : search_space | ||||||||||||||||||||||||||||||||||||||||||
| 340 | Usage : $obj->search_space($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 341 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 342 | Returns : value of search_space | ||||||||||||||||||||||||||||||||||||||||||
| 343 | Args : newvalue (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 4 | ▶ | sub search_space{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
search_space: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 4 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 4 | ▶ | if( defined $value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 2 | $self->{'search_space'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 4 | return $self->{'search_space'}; | |||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||