~ubuntu-branches/ubuntu/saucy/bioperl/saucy-proposed

« back to all changes in this revision

Viewing changes to t/Coalescent.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*-Perl-*-
2
 
# $Id: Coalescent.t,v 1.5 2003/12/16 01:12:34 jason Exp $
3
 
## Bioperl Test Harness Script for Modules
4
 
##
5
 
 
6
 
my $error;
7
 
use strict;
8
 
BEGIN { 
9
 
    # to handle systems with no installed Test module
10
 
    # we include the t dir (where a copy of Test.pm is located)
11
 
    # as a fallback
12
 
    $error = 0; 
13
 
    eval { require Test; };
14
 
    if( $@ ) {
15
 
        use lib 't';
16
 
    }
17
 
    use Test;
18
 
    plan tests => 11;
19
 
}
20
 
 
21
 
use Bio::PopGen::Simulation::Coalescent;
22
 
use Bio::PopGen::Statistics;
23
 
use Bio::TreeIO;
24
 
ok(1);
25
 
 
26
 
use vars qw($FILE1);
27
 
$FILE1 = 'out.tre';
28
 
END { unlink $FILE1; }
29
 
 
30
 
my $ssize = 5;
31
 
my $sim = new Bio::PopGen::Simulation::Coalescent(-sample_size => $ssize);
32
 
my $stats = Bio::PopGen::Statistics->new();
33
 
my $tree = $sim->next_tree;
34
 
 
35
 
ok($tree->get_nodes, ($ssize * 2 - 1));
36
 
 
37
 
my $treeio = new Bio::TreeIO(-format => 'newick', -file => ">$FILE1");
38
 
 
39
 
$treeio->write_tree($tree);
40
 
undef $treeio;
41
 
 
42
 
ok(-s $FILE1);
43
 
my $mutcount = 100;
44
 
$sim->add_Mutations($tree, $mutcount);
45
 
 
46
 
my $leaves = [$tree->get_leaf_nodes];
47
 
# $stats->verbose(1);
48
 
my $pi = $stats->pi($leaves);
49
 
ok( $pi > 0 , 1, 'pi');
50
 
 
51
 
 
52
 
# theta is num seg sites / sum(1/(numsams-1))
53
 
my $theta = $stats->theta(scalar @$leaves, $mutcount);
54
 
ok($theta,48, 'theta');
55
 
 
56
 
my $tD = Bio::PopGen::Statistics->tajima_D($leaves);
57
 
ok(defined $tD,1, 'tajimaD');
58
 
 
59
 
my $seg_sites = Bio::PopGen::Statistics->segregating_sites_count($leaves);
60
 
ok($seg_sites,$mutcount,
61
 
   'all the mutations should be polymorphic (by definition)');
62
 
my $single = Bio::PopGen::Statistics->singleton_count($leaves);
63
 
my $flD = Bio::PopGen::Statistics->fu_and_li_D($leaves,$single);
64
 
ok(defined $flD,1,'fu and li D');
65
 
 
66
 
my $flD_star = $stats->fu_and_li_D_star($leaves);
67
 
ok(defined $flD_star,1,'fu and li D*');
68
 
 
69
 
my $flF = $stats->fu_and_li_F($leaves,$single);
70
 
ok(defined $flF, 1,'fu and li F');
71
 
 
72
 
my $flFstar = $stats->fu_and_li_F_star($leaves);
73
 
ok(defined $flF, 1,'fu and li F');