The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bio::PopGen::Simulation::GeneticDrift - A simple genetic drift simulation

SYNOPSIS

  use Bio::PopGen::Simulation::GeneticDrift;
  my $sim = Bio::PopGen::Simulation::GeneticDrift->new(-popsize => 40,
						      -alleles => {A => 0.2,
							           B => 0.8});
  for(my $i =0 ;$i < 10; $i++ ) {
    my %f = $sim->next_generation; # get the freqs for each generation
  }

  for(my $i =0 ;$i < 10; $i++ ) {
    # get the allele freqs as part of a Bio::PopGen::Population object
    my $pop = $sim->next_generation('population'); 
  }

DESCRIPTION

A very simple 1 locus multi-allele random drift module, start with an initial set of allele frequency and simulate what happens over time.

This isn't really useful for anything in particular yet but will be built upon.

See Gillespie JH. (1998) "Population Genetics: a Concise guide." The Johns Hopkins University Press, Baltimore, USA. pp.19-47.

FEEDBACK

Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

Support

Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via email or the web:

https://github.com/bioperl/bioperl-live/issues

AUTHOR - Jason Stajich

Email jason-at-bioperl-dot-org

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

new

Title   : new
Usage   : my $obj = Bio::PopGen::Simulation::GeneticDrift->new();
Function: Builds a new Bio::PopGen::Simulation::GeneticDrift object 
Returns : an instance of Bio::PopGen::Simulation::GeneticDrift
Args    : -popsize => starting N
          -haploid => boolean if we should simulate haploids 
          -alleles => arrayref of the allele names
          OR
          -population => L<Bio::PopGen::PopulationI> object to initialize 
                         from some previously defined Population object
                         (or result from a previous simulation)

next_generation

Title   : next_generation
Usage   : my %generation = $sim->next_generation
Function: Get the next generation of allele frequencies based on the current
          generation
Returns : Hash of allele frequencies
Args    : 'allelefreqs' or 'population' to get back a hash of allele 
                frequencies (default) OR a L<Bio::PopGen::Population> object

population_size

Title   : population_size
Usage   : $obj->population_size($newval)
Function: 
Example : 
Returns : value of population_size (a scalar)
Args    : on set, new value (a scalar or undef, optional)

set_Frequencies_Equivalent

Title   : set_Frequencies_Equivalent
Usage   : $sim->set_Frequencies_Equivalent
Function: Reset the allele frequencies so they are all even
Returns : none
Args    : none

get_Allele_Frequencies

Title   : get_Allele_Frequencies
Usage   : my %allele_freqs = $marker->get_Allele_Frequencies;
Function: Get the alleles and their frequency (set relative to
          a given population - you may want to create different
          markers with the same name for different populations
          with this current implementation
Returns : Associative array where keys are the names of the alleles
Args    : none

add_Allele_Frequency

Title   : add_Allele_Frequency
Usage   : $marker->add_Allele_Frequency($allele,$freq)
Function: Adds an allele frequency
Returns : None
Args    : $allele - allele name
          $freq   - frequency value

reset_alleles

Title   : reset_alleles
Usage   : $marker->reset_alleles();
Function: Reset the alleles for a marker
Returns : None
Args    : None

validate_Frequencies

Title   : validate_Frequencies
Usage   : if( $sim->validate_Frequencies) {}
Function: Sanity checker that allele frequencies sum to 1 or less
Returns : boolean
Args    : -strict => 1 boolean if you want to insure that sum of freqs is 1