1
# -*-Perl-*- Test Harness script for Bioperl
2
# $Id: Coalescent.t 15112 2008-12-08 18:12:38Z sendu $
10
test_begin(-tests => 13);
12
use_ok('Bio::PopGen::Simulation::Coalescent');
13
use_ok('Bio::PopGen::Statistics');
14
use_ok('Bio::TreeIO');
18
my $sim = Bio::PopGen::Simulation::Coalescent->new(-sample_size => $ssize);
19
my $stats = Bio::PopGen::Statistics->new();
20
my $tree = $sim->next_tree;
22
is($tree->get_nodes, ($ssize * 2 - 1));
24
my $FILE1 = test_output_file();
25
my $treeio = Bio::TreeIO->new(-format => 'newick', -file => ">$FILE1");
27
$treeio->write_tree($tree);
32
$sim->add_Mutations($tree, $mutcount);
34
my $leaves = [$tree->get_leaf_nodes];
36
my $pi = $stats->pi($leaves);
37
is( $pi > 0 , 1, 'pi');
40
# theta is num seg sites / sum(1/(numsams-1))
41
my $theta = $stats->theta(scalar @$leaves, $mutcount);
42
is($theta,48, 'theta');
44
my $tD = Bio::PopGen::Statistics->tajima_D($leaves);
45
is(defined $tD,1, 'tajimaD');
47
my $seg_sites = Bio::PopGen::Statistics->segregating_sites_count($leaves);
48
is($seg_sites,$mutcount,
49
'all the mutations should be polymorphic (by definition)');
50
my $single = Bio::PopGen::Statistics->singleton_count($leaves);
51
my $flD = Bio::PopGen::Statistics->fu_and_li_D($leaves,$single);
52
is(defined $flD,1,'fu and li D');
54
my $flD_star = $stats->fu_and_li_D_star($leaves);
55
is(defined $flD_star,1,'fu and li D*');
57
my $flF = $stats->fu_and_li_F($leaves,$single);
58
is(defined $flF, 1,'fu and li F');
60
my $flFstar = $stats->fu_and_li_F_star($leaves);
61
is(defined $flF, 1,'fu and li F');