1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 34);
12 use_ok('Bio::Tree::Node');
13 use_ok('Bio::Tree::AlleleNode');
16 my $node1 = Bio::Tree::Node->new();
17 my $node2 = Bio::Tree::Node->new();
18 ok($node1->is_Leaf() );
19 is($node1->ancestor, undef);
22 ok ! $node1->has_tag('test');
23 is $node1->add_tag_value('test','a'), 1;
24 ok $node1->has_tag('test');
25 is $node1->add_tag_value('test','b'), 2;
26 my @tags = $node1->get_tag_values('test');
28 is scalar $node1->get_tag_values('test'), 'a', 'retrieve the first value';
30 is $node1->remove_tag('test2'), 0;
31 is $node1->remove_tag('test'), 1;
32 ok ! $node1->has_tag('test');
33 is $node1->set_tag_value('test',('a','b','c')), 3;
34 is $node1->remove_all_tags(), undef;
35 ok ! $node1->has_tag('test');
38 my $pnode = Bio::Tree::Node->new();
39 $pnode->add_Descendent($node1);
40 is($node1->ancestor, $pnode);
41 $pnode->add_Descendent($node2);
42 is($node2->ancestor, $pnode);
44 ok(! $pnode->is_Leaf);
46 my $phylo_node = Bio::Tree::Node->new(-bootstrap => 0.25,
49 $node1->add_Descendent($phylo_node);
50 ok(! $node1->is_Leaf);
51 is($phylo_node->ancestor, $node1);
52 is($phylo_node->id, 'ADH_BOV');
53 is($phylo_node->bootstrap, 0.25);
54 is($phylo_node->description, 'Taxon 1');
56 is $phylo_node->ancestor($node2), $node2;
58 is my @descs = $node2->each_Descendent, 1;
59 is $descs[0], $phylo_node;
61 my $allele_node = Bio::Tree::AlleleNode->new();
62 $allele_node->add_Genotype(Bio::PopGen::Genotype->new(-marker_name => 'm1',
64 $allele_node->add_Genotype(Bio::PopGen::Genotype->new(-marker_name => 'm3',
66 $allele_node->add_Genotype(Bio::PopGen::Genotype->new(-marker_name => 'm4',
69 my @mkrs = $allele_node->get_marker_names;
72 my ($m3) = $allele_node->get_Genotypes(-marker => 'm3');
73 is($m3->get_Alleles, 2);
74 my ($a1) = $allele_node->get_Genotypes(-marker => 'm1')->get_Alleles;
77 my ($a2,$a3) = $allele_node->get_Genotypes(-marker => 'm4')->get_Alleles;