1 # This is -*-Perl-*- code
2 ## Bioperl Test Harness Script for Modules
6 # Before `make install' is performed this script should be runnable with
7 # `make test'. After `make install' it should work as `perl test.t'
10 use vars qw($NUMTESTS);
15 # to handle systems with no installed Test module
16 # we include the t dir (where a copy of Test.pm is located)
18 eval { require Test; };
26 plan tests => $NUMTESTS;
28 unless (eval "require IO::String; 1;") {
29 print STDERR "IO::String not installed. Skipping tests $Test::ntest to $NUMTESTS.\n";
30 for ($Test::ntest..$NUMTESTS){
41 foreach ( $Test::ntest .. $NUMTESTS ) {
42 skip("unable to run all of the PAML tests",1);
48 ## End of black magic.
50 ## Insert additional test code below but remember to change
51 ## the print "1..x\n" in the BEGIN block to reflect the
52 ## total number of tests that will be run.
54 use Bio::Tools::Phylo::PAML; # PAML parser
57 my $inpaml = new Bio::Tools::Phylo::PAML(-file =>
58 Bio::Root::IO->catfile(qw(t data
63 use Bio::Tools::Run::Phylo::PAML::Codeml;
64 use Bio::Tools::Run::Phylo::PAML::Yn00;
66 my $codeml = new Bio::Tools::Run::Phylo::PAML::Codeml(-verbose => $verbose);
67 unless ($codeml->executable) {
68 warn("PAML not is installed. skipping tests $Test::ntest to $NUMTESTS\n");
72 my $in = new Bio::AlignIO(-format => 'phylip',
73 -file => Bio::Root::IO->catfile(qw(t data
75 my $aln = $in->next_aln;
76 $codeml->alignment($aln);
77 my ($rc,$results) = $codeml->run();
80 if( ! defined $results ) {
84 my $result = $results->next_result;
85 my $MLmatrix = $result->get_MLmatrix;
87 my ($vnum) = ($result->version =~ /(\d+\.\d+)/);
90 ok($MLmatrix->[0]->[1]->{'dN'}, 0.0693);
91 ok($MLmatrix->[0]->[1]->{'dS'},1.1459);
92 ok($MLmatrix->[0]->[1]->{'omega'}, 0.0605);
93 ok($MLmatrix->[0]->[1]->{'S'}, 273.5);
94 ok($MLmatrix->[0]->[1]->{'N'}, 728.5);
95 ok($MLmatrix->[0]->[1]->{'t'}, 1.0895);
96 } elsif( $vnum >= 3.13 ) {
98 ok($MLmatrix->[0]->[1]->{'dN'}, 0.0713);
99 ok($MLmatrix->[0]->[1]->{'dS'},1.2462);
100 ok(sprintf("%.4f",$MLmatrix->[0]->[1]->{'omega'}), 0.0572);
101 ok($MLmatrix->[0]->[1]->{'S'}, 278.8);
102 ok($MLmatrix->[0]->[1]->{'N'}, 723.2);
103 ok(sprintf("%.4f",$MLmatrix->[0]->[1]->{'t'}), 1.1946);
106 skip("Can't test the result output, don't know about PAML version ".$result->version,1);
110 ok($codeml->error_string !~ /Error/); # we don't expect any errors;
112 my $yn00 = Bio::Tools::Run::Phylo::PAML::Yn00->new();
113 $yn00->alignment($aln);
114 ($rc,$results) = $yn00->run();
116 if( ! defined $results ) {
119 $result = $results->next_result;
120 $MLmatrix = $result->get_MLmatrix;
122 ok($MLmatrix->[0]->[1]->{'dN'}, 0.0846);
123 ok($MLmatrix->[0]->[1]->{'dS'}, 1.0926);
124 ok($MLmatrix->[0]->[1]->{'omega'}, 0.0774);
125 ok($MLmatrix->[0]->[1]->{'S'}, 278.4);
126 ok($MLmatrix->[0]->[1]->{'N'}, 723.6);
127 ok($MLmatrix->[0]->[1]->{'t'}, 1.0941);
129 ok($yn00->error_string !~ /Error/); # we don't expect any errors;
132 $codeml = new Bio::Tools::Run::Phylo::PAML::Codeml
133 (-params => { 'alpha' => 1.53 },
134 -verbose => $verbose);