Bio-Tools-Phylo-PAML

 view release on metacpan or  search on metacpan

lib/Bio/Tools/Phylo/PAML/Result.pm  view on Meta::CPAN

  if( $aafreq ) {
      if( ref($aafreq) =~ /HASH/i ) {
      $self->set_AAFreqs($aafreq);
      } else {
      $self->warn("Must provide a valid hash reference to initialize aafreq");
      }
  }
  if( $stats ) {
      if( ref($stats) =~ /HASH/i ) {
      while( my ($stat,$val) = each %$stats) {
          $self->add_stat($stat,$val);
      }
      } else {
      $self->warn("Must provide a valid hash reference initialize stats");
      }
  }
  $self->set_AADistMatrix($aadistmat) if defined $aadistmat;
  $self->set_AAMLDistMatrix($aamldistmat) if defined $aamldistmat;

  if( defined $NSSitesresults ) {
      if( ref($NSSitesresults) !~ /ARRAY/i ) {

lib/Bio/Tools/Phylo/PAML/Result.pm  view on Meta::CPAN

 Function: Get the NT freqs, either for every sequence or just
           for a specific sequence
           The average nt freqs for the entire set are also available
           for the sequence named 'Average'
 Returns : Hashref
 Args    : (optional) sequence name to retrieve nt freqs for

=head2 add_stat

 Title   : add_stat
 Usage   : $result->add_stat($stat,$value);
 Function: Add some misc stat valuess (key/value pairs)
 Returns : none
 Args    : $stat  stat name
           $value stat value

=head2 get_stat

 Title   : get_stat
 Usage   : my $value = $result->get_stat($name);
 Function: Get the value for a stat of a given name
 Returns : scalar value
 Args    : name of the stat

=head2 get_stat_names

 Title   : get_stat_names
 Usage   : my @names = $result->get_stat_names;
 Function: Get the stat names stored for the result
 Returns : array of names

t/PAML-parser.t  view on Meta::CPAN


is($result->get_AAFreqs('Average')->{'I'},0.0424);

my $patterns = $result->patterns;
my @pat = @{$patterns->{'-patterns'}};
is(scalar @pat, 98);
is($patterns->{'-ns'}, 6);
is($patterns->{'-ls'}, 130);

is((sort $result->get_stat_names)[0], 'constant_sites');
is($result->get_stat('constant_sites'), 46);
is($result->get_stat('constant_sites_percentage'), 35.38);

# AAML parsing - pairwise model
$inpaml = Bio::Tools::Phylo::PAML->new(-file => test_input_file('aaml_pairwise.mlc'));

ok($inpaml);
$result = $inpaml->next_result;
ok($result);
is($result->model, 'Empirical_F (wag.dat)');
is($result->get_stat('loglikelihood'),-1189.106658);
is($result->get_stat('constant_sites'), 170);
is($result->get_stat('constant_sites_percentage'), 59.65);

is($result->get_AAFreqs('Average')->{'R'},0.0211);
is($result->get_AAFreqs('rabbit')->{'L'},0.1228);

$aadistmat = $result->get_AADistMatrix();
ok($aadistmat);
is($aadistmat->get_entry('rabbit', 'marsupial'), 0.2877);
is($aadistmat->get_entry('human', 'goat-cow'), 0.1439);

$aadistmat = $result->get_AAMLDistMatrix();

t/PAML-parser.t  view on Meta::CPAN


my $codeml_single = Bio::Tools::Phylo::PAML->new
    (-file => test_input_file('singleNSsite.mlc'));
ok($codeml_single);
my $result_single = $codeml_single->next_result;
my ($nssite_single) = $result_single->get_NSSite_results;
is($nssite_single->num_site_classes,q/3/);
is($nssite_single->kappa, q/5.28487/);
is($nssite_single->likelihood,q/-30.819156/);

is($baseml->get_stat('loglikelihood'),-110.532715);
is($baseml->get_stat('constant_sites'),46);
is($baseml->get_stat('constant_sites_percentage'),'80.70');
is($baseml->model,'HKY85 dGamma (ncatG=5)');

# user trees
$baseml_p = Bio::Tools::Phylo::PAML->new
    (-file => test_input_file('baseml.usertree'));
$baseml = $baseml_p->next_result;

@trees = $baseml->get_trees;
is(@trees, 1);
is($trees[0]->score, -129.328757);



( run in 1.180 second using v1.01-cache-2.11-cpan-49f99fa48dc )