File: ProtDist.t

package info (click to toggle)
bioperl 1.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 40,768 kB
  • ctags: 12,005
  • sloc: perl: 174,299; xml: 13,923; sh: 1,941; lisp: 1,803; asm: 109; makefile: 53
file content (95 lines) | stat: -rw-r--r-- 2,423 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# -*-Perl-*- Test Harness script for Bioperl
# $Id: ProtDist.t 15112 2008-12-08 18:12:38Z sendu $

use strict;

BEGIN {
    use lib '.';
    use Bio::Root::Test;
    
    test_begin(-tests => 47);
	
    use_ok('Bio::Tools::Phylo::Phylip::ProtDist');
}

my $inputfilename= test_input_file('phylipdist.out');
my $tool= Bio::Tools::Phylo::Phylip::ProtDist->new(-file => $inputfilename);
my $phy = $tool->next_matrix;
is(@{$phy->names}, 5);
is $phy->get_entry('Alpha','Beta'), '4.23419';
is $phy->get_entry('Gamma','Alpha'),'3.63330';
my @column =  $phy->get_column('Alpha');
is $column[0], '0.00000';
is $column[1], '4.23419';
is $column[2], '3.63330';
is $column[3], '6.20865';
is $column[4], '3.45431';

my @row    = $phy->get_row('Gamma');
is $row[0], '3.63330';
is $row[1], '3.49289';
is $row[2], '0.00000';
is $row[3], '3.68733';
is $row[4], '5.84929';

my @diag   = $phy->get_diagonal;


is $diag[0], '0.00000';
is $diag[1], '0.00000';
is $diag[2], '0.00000';
is $diag[3], '0.00000';
is $diag[4], '0.00000';

my $matrix =<<END;
    5
Alpha          0.00000  4.23419  3.63330  6.20865  3.45431
Beta           4.23419  0.00000  3.49289  3.36540  4.29179
Gamma          3.63330  3.49289  0.00000  3.68733  5.84929
Delta          6.20865  3.36540  3.68733  0.00000  4.43345
Epsilon        3.45431  4.29179  5.84929  4.43345  0.00000
END
;
is $phy->print_matrix , $matrix;

# now parse Phylip 3.6 output

$inputfilename= test_input_file('phylipdist-36.out');
$tool= Bio::Tools::Phylo::Phylip::ProtDist->new(-file => $inputfilename);
$phy = $tool->next_matrix;

is(@{$phy->names}, 39);
is $phy->get_entry('CBG01299','CBG00435'), '4.7793';
is $phy->get_entry('CBG22788','CBG22521'),'5.3195';
is $phy->get_entry('CBG01466', 'CBG01473'), '3.3944';

@row = $phy->get_row('CBG01473');
is(scalar @row, 39);
@column =  $phy->get_column('CBG01300');
is $column[0], '0.0817';
is $column[1], '0.0000';
is $column[2], '0.0950';
is $column[3], '0.3111';
is $column[37], '4.7190';
is $column[38], '4.7592';

@row    = $phy->get_row('CBG17433');
is $row[0], '4.8451';
is $row[1], '4.5982';
is $row[2], '4.0620';
is $row[3], '5.9673';
is $row[4], '4.6224';
is $row[5], '5.1993';
is $row[6], '5.4427';
is $row[7], '4.2783';

@diag   = $phy->get_diagonal;

is $diag[0], '0.0000';
is $diag[1], '0.0000';
is $diag[2], '0.0000';
is $diag[3], '0.0000';
is $diag[4], '0.0000';
is $diag[5], '0.0000';
is $diag[37], '0.0000';
is $diag[38], '0.0000';