| 1 | package Bio::Phylo::Models::Substitution::Dna::HKY85; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use base | ||
| 5 | qw'Bio::Phylo::Models::Substitution::Dna::K80 Bio::Phylo::Models::Substitution::Dna::F81'; | ||
| 6 | my %purines = ( 'A' => 1, 'G' => 1 ); | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Bio::Phylo::Models::Substitution::Dna::HKY85 - Hasegawa, Kishino, Yano (1985) model | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | See L<Bio::Phylo::Models::Substitution::Dna> | ||
| 15 | |||
| 16 | =head1 METHODS | ||
| 17 | |||
| 18 | =over | ||
| 19 | |||
| 20 | =item get_nst | ||
| 21 | |||
| 22 | Getter for number of transition rate parameters. | ||
| 23 | |||
| 24 | Type : method | ||
| 25 | Title : get_nst | ||
| 26 | Usage : $model->get_nst; | ||
| 27 | Function: Getter for number of transition rate parameters. | ||
| 28 | Returns : scalar | ||
| 29 | Args : None. | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | sub get_nst { 2 } | ||
| 34 | |||
| 35 | =item get_rate | ||
| 36 | |||
| 37 | Getter for substitution rate. If bases are given as arguments, | ||
| 38 | returns corresponding rate. If no arguments given, returns rate matrix or | ||
| 39 | overall rate, dependent on model. | ||
| 40 | |||
| 41 | Type : method | ||
| 42 | Title : get_rate | ||
| 43 | Usage : $model->get_rate('A', 'C'); | ||
| 44 | Function: Getter for transition rate between nucleotides. | ||
| 45 | Returns : scalar or array | ||
| 46 | Args : Optional: | ||
| 47 | base1: scalar | ||
| 48 | base2: scalar | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | # subst rate | ||
| 53 | sub get_rate { | ||
| 54 | my $self = shift; | ||
| 55 | if ( scalar @_ == 2 ) { | ||
| 56 | my ( $src, $trgt ) = ( uc $_[0], uc $_[1] ); | ||
| 57 | |||
| 58 | # transversion | ||
| 59 | if ( $purines{$src} xor $purines{$trgt} ) { | ||
| 60 | return $self->get_kappa * $self->get_rate($src); | ||
| 61 | } | ||
| 62 | |||
| 63 | # transition | ||
| 64 | else { | ||
| 65 | return $self->get_rate($src); | ||
| 66 | } | ||
| 67 | } | ||
| 68 | } | ||
| 69 | |||
| 70 | =back | ||
| 71 | |||
| 72 | =head1 SEE ALSO | ||
| 73 | |||
| 74 | There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo> | ||
| 75 | for any user or developer questions and discussions. | ||
| 76 | |||
| 77 | =over | ||
| 78 | |||
| 79 | =item L<Bio::Phylo::Manual> | ||
| 80 | |||
| 81 | Also see the manual: L<Bio::Phylo::Manual> and L<http://rutgervos.blogspot.com>. | ||
| 82 | |||
| 83 | =back | ||
| 84 | |||
| 85 | =head1 CITATION | ||
| 86 | |||
| 87 | If you use Bio::Phylo in published research, please cite it: | ||
| 88 | |||
| 89 | B<Rutger A Vos>, B<Jason Caravas>, B<Klaas Hartmann>, B<Mark A Jensen> | ||
| 90 | and B<Chase Miller>, 2011. Bio::Phylo - phyloinformatic analysis using Perl. | ||
| 91 | I<BMC Bioinformatics> B<12>:63. | ||
| 92 | L<http://dx.doi.org/10.1186/1471-2105-12-63> | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | 1; |