tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / examples / tools / parse_codeml.pl
blobf5c3a2a234aaf1512747e726286a2f069a3b4e30
1 #!/usr/bin/perl -w
3 use strict;
4 use Bio::Tools::Phylo::PAML;
5 use Bio::Root::IO;
7 my $parser = new Bio::Tools::Phylo::PAML(-file => shift,
8 -verbose => shift);
10 my $result = $parser->next_result;
11 my @otus = $result->get_seqs();
12 my $MLmatrix = $result->get_MLmatrix();
13 my $NGmatrix = $result->get_NGmatrix();
15 # These matrices are length(@otu) x length(@otu) "strict lower
16 # triangle" 2D-matrices, which means that the diagonal and
17 # everything above it is undefined. Each of the defined cells is a
18 # hashref of estimates for "dN", "dS", "omega" (dN/dS ratio), "t",
19 # "S" and "N". If a ML matrix, "lnL" will also be defined.
21 @otus = $result->get_seqs();
22 $MLmatrix = $result->get_MLmatrix();
23 $NGmatrix = $result->get_NGmatrix();
24 for( my $i=0;$i<scalar @$MLmatrix;$i++) {
25 for( my $j = $i+1; $j < scalar @{$MLmatrix->[$i]}; $j++ ) {
26 printf "The ML omega ratio for sequences %s vs %s was: %g\n",
27 $otus[$i]->id, $otus[$j]->id, $MLmatrix->[$i]->[$j]->{omega};
31 for( my $i=0;$i<scalar @$MLmatrix;$i++) {
32 for( my $j = $i+1; $j < scalar @{$MLmatrix->[$i]}; $j++ ) {
34 printf "The NG omega ratio for sequences %s vs %s was: %g\n",
35 $otus[$i]->id, $otus[$j]->id, $NGmatrix->[$i]->[$j]->{'omega'};