1
# -*-Perl-*- mode for emacs
2
# $Id: PopGenSims.t,v 1.3 2003/10/25 14:52:22 heikki Exp $
4
# This will outline tests for the population genetics simulation
5
# in the Bio::PopGen::Simulation namespace
6
# Coalescent has its own tests though in t/Coalescent.t
10
use vars qw($SKIPXML $LASTXMLTEST);
15
# to handle systems with no installed Test module
16
# we include the t dir (where a copy of Test.pm is located)
18
eval { require Test; };
27
plan tests => $NTESTS;
36
use Bio::PopGen::Simulation::GeneticDrift;
38
my $sim = new Bio::PopGen::Simulation::GeneticDrift(-popsize => 40,
39
-alleles => {A => 0.2,
43
for(my $i =0 ;$i < 10; $i++ ) {
44
my %f = $sim->next_generation;
45
push @Afreqs, $f{'A'};
46
push @Bfreqs, $f{'B'};
47
ok(($f{'A'}||0) + ($f{'B'}||0), 1, 'Allele freqs should sum to 1');
51
ok(($Afreqs[9]||0) <= 1, 1, 'All frequencies should be <= 1');
53
$sim = new Bio::PopGen::Simulation::GeneticDrift(-popsize => 50,
54
-alleles => {A => 0.2,
59
for(my $i =0 ;$i < 10; $i++ ) {
60
my %f = $sim->next_generation;
61
ok(($f{'A'}||0) + ($f{'B'}||0) + ($f{'C'}||0), 1, 'Allele freqs should sum to 1');