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
|
# -*-Perl-*- Test Harness script for Bioperl
# $Id: TreeIO.t 14580 2008-03-01 17:01:30Z cjfields $
use strict;
BEGIN {
use Bio::Root::Test;
test_begin(-tests => 24);
use_ok('Bio::TreeIO');
}
my $verbose = test_debug();
# try lintree parsing
my $treeio = Bio::TreeIO->new(-format => 'lintree',
-file => test_input_file('crab.njb'));
my ($tree, @leaves, $node);
while( $tree = $treeio->next_tree ) {
isa_ok($tree, 'Bio::Tree::TreeI');
my @nodes = $tree->get_nodes;
@leaves = $tree->get_leaf_nodes;
is(@leaves, 13);
#/maj is(@nodes, 25);
is(@nodes, 24); #/maj
($node) = $tree->find_node(-id => '18');
ok($node);
is($node->id, '18');
is($node->branch_length, '0.030579');
is($node->bootstrap, 998);
}
$treeio = Bio::TreeIO->new(-format => 'lintree',
-file => test_input_file('crab.nj'));
$tree = $treeio->next_tree;
isa_ok($tree, 'Bio::Tree::TreeI');
my @nodes = $tree->get_nodes;
@leaves = $tree->get_leaf_nodes;
is(@leaves, 13);
#/maj is(@nodes, 25);
is(@nodes, 24); #/maj
($node) = $tree->find_node('18');
is($node->id, '18');
is($node->branch_length, '0.028117');
($node) = $tree->find_node(-id => 'C-vittat');
is($node->id, 'C-vittat');
is($node->branch_length, '0.087619');
is($node->ancestor->id, '14');
$treeio = Bio::TreeIO->new(-format => 'lintree',
-file => test_input_file('crab.dat.cn'));
$tree = $treeio->next_tree;
isa_ok($tree, 'Bio::Tree::TreeI');
@nodes = $tree->get_nodes;
@leaves = $tree->get_leaf_nodes;
is(@leaves, 13, "Leaf nodes");
#/maj is(@nodes, 25, "All nodes");
is(@nodes, 24, "All nodes"); #/maj
($node) = $tree->find_node('18');
is($node->id, '18');
is($node->branch_length, '0.029044');
($node) = $tree->find_node(-id => 'C-vittat');
is($node->id, 'C-vittat');
is($node->branch_length, '0.097855');
is($node->ancestor->id, '14');
|