clean up XMFA parsing, allow spaces in parsing (ende++, from IRC)
[bioperl-live.git] / t / Molphy.t
blobed8171c19fb66624ef828878066ad5bd47744dc3
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN { 
7         use lib 't/lib';
8     use BioperlTest;
9     
10     test_begin(-tests => 18,
11                            -requires_module => 'IO::String');
12         
13         use_ok('Bio::Tools::Phylo::Molphy');
16 my $verbose = test_debug();
18 my $inmolphy = Bio::Tools::Phylo::Molphy->new(-file => test_input_file('lysozyme6.simple.protml'));
19 ok($inmolphy);
20 my $r = $inmolphy->next_result;
21 ok($r);
22 is($r->model, 'JTT');
23 is($r->search_space,50);
24 my @trees;
25 while( my $t = $r->next_tree ) { 
26     push @trees, $t;
28 is(@trees,5);
29  $inmolphy = Bio::Tools::Phylo::Molphy->new(-file => test_input_file('lysozyme6.protml'));
30 ok($inmolphy);
31 $r = $inmolphy->next_result;
32 is($r->model, 'JTT');
33 is($r->search_space,50);
34 @trees = ();
35 while( my $t = $r->next_tree ) { 
36     push @trees, $t;
38 is(@trees,5);
40 is($trees[0]->score, -1047.8);
41 is($trees[-1]->id, 9);
43 my $tpm = $r->transition_probability_matrix;
44 is($tpm->{'Val'}->{'Val'}, -122884);
45 is($tpm->{'Ala'}->{'Arg'}, 2710);
47 my $sub_mat = $r->substitution_matrix;
48 is($sub_mat->{'Val'}->{'Tyr'}, 50);
49 is($sub_mat->{'Arg'}->{'Ile'}, 72);
50 is($sub_mat->{'Met'}->{'Met'}, '');
52 my %fmat = $r->residue_frequencies();
53 is($fmat{'D'}->[0], 0.052);