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

« back to all changes in this revision

Viewing changes to Bio/PopGen/Simulation/Coalescent.pm

  • 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
 
# $Id: Coalescent.pm,v 1.11.4.1 2006/10/02 23:10:23 sendu Exp $
 
1
# $Id: Coalescent.pm 15149 2008-12-12 10:52:28Z heikki $
2
2
#
3
3
# BioPerl module for Bio::PopGen::Simulation::Coalescent
4
4
#
100
100
=head2 new
101
101
 
102
102
 Title   : new
103
 
 Usage   : my $obj = new Bio::PopGen::Simulation::Coalescent();
 
103
 Usage   : my $obj = Bio::PopGen::Simulation::Coalescent->new();
104
104
 Function: Builds a new Bio::PopGen::Simulation::Coalescent object 
105
105
 Returns : an instance of Bio::PopGen::Simulation::Coalescent
106
106
 Args    : -samples => arrayref of sample names
158
158
   # If maxcount is set to something non-zero then next tree will
159
159
   # continue to return valid trees until maxcount is reached
160
160
   # otherwise will always return trees 
161
 
   return undef if( $self->maxcount &&
162
 
                    $self->{'_treecounter'}++ >= $self->maxcount );
 
161
   return if( $self->maxcount &&
 
162
              $self->{'_treecounter'}++ >= $self->maxcount );
163
163
   my $size = $self->sample_size;
164
164
   
165
165
   my $in;
207
207
   my @nodes = ();   
208
208
   foreach my $n ( @tree ) { 
209
209
       push @nodes, 
210
 
           new Bio::Tree::AlleleNode(-id => $n->{'nodenum'},
 
210
           Bio::Tree::AlleleNode->new(-id => $n->{'nodenum'},
211
211
                                     -branch_length => $n->{'time'});
212
212
   }
213
213
   my $ct = 0;
288
288
 
289
289
       # We're using an infinite sites model so every new
290
290
       # mutation is a new site
291
 
       my $g = new Bio::PopGen::Genotype(-marker_name  => "Mutation$j",
 
291
       my $g = Bio::PopGen::Genotype->new(-marker_name  => "Mutation$j",
292
292
                                         -alleles => [1]);
293
293
       $nodes[$branch]->add_Genotype($g);
294
294
       push @mutations, "Mutation$j";
303
303
   foreach my $node ( @nodes ) {
304
304
       foreach my $m ( @mutations ) {
305
305
           if( ! $node->has_Marker($m) ) {
306
 
               my $emptyg = new Bio::PopGen::Genotype(-marker_name => $m,
 
306
               my $emptyg = Bio::PopGen::Genotype->new(-marker_name => $m,
307
307
                                                      -alleles     => [0]);
308
308
               $node->add_Genotype($emptyg);
309
309
           }