1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: TreeIO.t 14580 2008-03-01 17:01:30Z cjfields $
10 test_begin(-tests => 24);
11 use_ok('Bio::TreeIO');
14 my $verbose = test_debug();
17 my $treeio = Bio::TreeIO->new(-format => 'lintree',
18 -file => test_input_file('crab.njb'));
20 my ($tree, @leaves, $node);
21 while( $tree = $treeio->next_tree ) {
23 isa_ok($tree, 'Bio::Tree::TreeI');
25 my @nodes = $tree->get_nodes;
27 @leaves = $tree->get_leaf_nodes;
31 ($node) = $tree->find_node(-id => '18');
34 is($node->branch_length, '0.030579');
35 is($node->bootstrap, 998);
38 $treeio = Bio::TreeIO->new(-format => 'lintree',
39 -file => test_input_file('crab.nj'));
41 $tree = $treeio->next_tree;
43 isa_ok($tree, 'Bio::Tree::TreeI');
45 my @nodes = $tree->get_nodes;
46 @leaves = $tree->get_leaf_nodes;
50 ($node) = $tree->find_node('18');
52 is($node->branch_length, '0.028117');
54 ($node) = $tree->find_node(-id => 'C-vittat');
55 is($node->id, 'C-vittat');
56 is($node->branch_length, '0.087619');
57 is($node->ancestor->id, '14');
59 $treeio = Bio::TreeIO->new(-format => 'lintree',
60 -file => test_input_file('crab.dat.cn'));
62 $tree = $treeio->next_tree;
64 isa_ok($tree, 'Bio::Tree::TreeI');
66 @nodes = $tree->get_nodes;
67 @leaves = $tree->get_leaf_nodes;
68 is(@leaves, 13, "Leaf nodes");
70 #/maj is(@nodes, 25, "All nodes");
71 is(@nodes, 24, "All nodes"); #/maj
72 ($node) = $tree->find_node('18');
75 is($node->branch_length, '0.029044');
77 ($node) = $tree->find_node(-id => 'C-vittat');
78 is($node->id, 'C-vittat');
79 is($node->branch_length, '0.097855');
80 is($node->ancestor->id, '14');