1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: TreeIO.t 14580 2008-03-01 17:01:30Z cjfields $
9 test_begin(-tests => 24);
10 use_ok('Bio::TreeIO');
13 my $verbose = test_debug();
16 my $treeio = Bio::TreeIO->new(-format => 'lintree',
17 -file => test_input_file('crab.njb'));
19 my ($tree, @leaves, $node);
20 while( $tree = $treeio->next_tree ) {
22 isa_ok($tree, 'Bio::Tree::TreeI');
24 my @nodes = $tree->get_nodes;
26 @leaves = $tree->get_leaf_nodes;
30 ($node) = $tree->find_node(-id => '18');
33 is($node->branch_length, '0.030579');
34 is($node->bootstrap, 998);
37 $treeio = Bio::TreeIO->new(-format => 'lintree',
38 -file => test_input_file('crab.nj'));
40 $tree = $treeio->next_tree;
42 isa_ok($tree, 'Bio::Tree::TreeI');
44 my @nodes = $tree->get_nodes;
45 @leaves = $tree->get_leaf_nodes;
49 ($node) = $tree->find_node('18');
51 is($node->branch_length, '0.028117');
53 ($node) = $tree->find_node(-id => 'C-vittat');
54 is($node->id, 'C-vittat');
55 is($node->branch_length, '0.087619');
56 is($node->ancestor->id, '14');
58 $treeio = Bio::TreeIO->new(-format => 'lintree',
59 -file => test_input_file('crab.dat.cn'));
61 $tree = $treeio->next_tree;
63 isa_ok($tree, 'Bio::Tree::TreeI');
65 @nodes = $tree->get_nodes;
66 @leaves = $tree->get_leaf_nodes;
67 is(@leaves, 13, "Leaf nodes");
69 #/maj is(@nodes, 25, "All nodes");
70 is(@nodes, 24, "All nodes"); #/maj
71 ($node) = $tree->find_node('18');
74 is($node->branch_length, '0.029044');
76 ($node) = $tree->find_node(-id => 'C-vittat');
77 is($node->id, 'C-vittat');
78 is($node->branch_length, '0.097855');
79 is($node->ancestor->id, '14');