Simulating Mating Alliances as a Reproductive Tactic for Populations
 All Classes Functions Variables Friends
Public Member Functions | Public Attributes | Friends | List of all members
Population< T > Class Template Reference

Public Member Functions

 Population ()
 
 Population (int N, int mt, int xL, int xS, int y, int aL, int aS)
 
 Population (Population const &a)
 
 Population (std::string const &filename)
 
 ~Population ()
 
std::vector< T > get_pop (int current) const
 
Populationoperator= (Population const &)
 
void reset (int N)
 
void set_mating_system (int)
 
int get_matingSystem () const
 
void set_inbreeding (int)
 
int get_inbreeding () const
 
void set_mu (double, double, double, double)
 
void set_mu (double, double, double, double, double, double, double, double)
 
void set_growthFactor (double, double, double)
 
void set_growthFactor (std::vector< double >)
 
void resize (int)
 
double get_muMt1 () const
 
double get_muMt2 () const
 
double get_muA1 () const
 
double get_muA2 () const
 
double get_muX1 () const
 
double get_muX2 () const
 
double get_muY1 () const
 
double get_muY2 () const
 
int get_generation () const
 
int get_nbHuman () const
 
int get_nbFemale () const
 
int get_nbMale () const
 
int get_sizeMt () const
 
int get_sizeY () const
 
int get_sizePerX () const
 
int get_sizePerA () const
 
int get_crumbA () const
 
int get_crumbY () const
 
int get_crumbX () const
 
int get_crumbMt () const
 
int get_nbCellPerA () const
 
int get_nbCellPerX () const
 
int get_nbChromosomesA () const
 
int get_nbChromosomesX () const
 
std::vector< double > get_growthFactor () const
 
std::vector< int > get_nb_mates ()
 
std::vector< int > get_nb_children ()
 
Population subsample (int sampleSize, int nbWomen)
 
Population subsample_female ()
 
Population subsample_male ()
 
void evolve (int gen)
 
void evolve_gene (int gen, std::string filename)
 
void write_txt_pop (std::string const &) const
 
void output_pop_size () const
 
void write_nexus (std::string const &file_name) const
 
void write_fasta (std::string const &file_name) const
 
void output_genealogy (std::ofstream &fs)
 
void write_smartFormat (std::string const &filename) const
 
void output_arlequin (std::string const &filename)
 
void output_nb_child ()
 
void output_nb_mates ()
 
void test (int)
 
int burnin (int gen, double facMu)
 
int burnin (double diversityTreshold, int gen, double facMu)
 
void evolve_one ()
 
typeDNA polySites (int nuclear) const
 
typeDNA polySites_mtdna () const
 
double pairwise_distance_mtdna () const
 

Public Attributes

std::vector< T > female [2]
 
std::vector< T > male [2]
 

Friends

std::ostream & operator<< (std::ostream &os, Population const &a)
 

Constructor & Destructor Documentation

template<class T>
Population< T >::Population ( )
inline

Constructor.

template<class T>
Population< T >::Population ( int  N,
int  mt,
int  xL,
int  xS,
int  y,
int  aL,
int  aS 
)
inlineexplicit

Constructor from the population size, and the mtDNA sequence length, the number of X loci, size of each X locus, size of Y sequence, number of autosome loci and length of each of those.

template<class T>
Population< T >::Population ( Population< T > const &  a)
inline

Copy constructor.

template<class T>
Population< T >::Population ( td::string const & filename)
inline

Constructor from reading a file containing a population from a previous run.

template<class T>
Population< T >::~Population ( )
inline

Destructor

Member Function Documentation

template<class T>
int Population< T >::burnin ( int  gen,
double  facMu 
)

Starts a burn-in phase with a higher mutation rate. It will either stop once the maximum number of generations to run is reached.

template<class T>
int Population< T >::burnin ( double  diversityTreshold,
int  gen,
double  facMu 
)

Starts a burn-in phase with a higher mutation rate. It will either stop once the threshold is reached or once the maximum number of generations to run is reached.

template<class T >
void Population< T >::evolve ( int  gen)

Evolves a defined number of generation, calling evolve_one as many times.

template<class T >
void Population< T >::evolve_one ()

Runs a full cycle from one generation to the next, which includes reproduction and mutation.

template<class T >
void Population< T >::evolve_gene ( int  gen,
std::string  filename 
)

Evolves a defined number of generation, calling evolve_one as many times, saving the genealogy at the same time in the given file.

template<class T >
int Population< T >::get_generation ( ) const

Returns the number of generations that the population have evolved.

template<class T >
int Population< T >::get_inbreeding ( ) const

Returns the value of the inbreeding parameter. If the value is 1, alliances are forbidden between two individuals who share at least one parent.

template<class T >
int Population< T >::get_matingSystem ( ) const

Changes mating system

template<class T >
void Population< T >::reset ( )

Resets all the population values, and its inidviduals except for the size of sequences. Used to gain time when doing a set of several simulations with the same parameters.

template<class T >
double Population< T >::get_muA1 ( ) const

Returns the autosome transition rate.

template<class T >
double Population< T >::get_muA2 ( ) const

Returns the autosome transversion rate.

template<class T >
double Population< T >::get_muMt1 ( ) const

Returns the mtDNA transition rate.

template<class T >
double Population< T >::get_muMt2 ( ) const

Returns the mtDNA transversion rate.

template<class T >
double Population< T >::get_muX1 ( ) const

Returns the X transition rate.

template<class T >
double Population< T >::get_muX2 ( ) const

Returns the X transversion rate.

template<class T >
double Population< T >::get_muY1 ( ) const

Returns the Y transition rate.

template<class T >
double Population< T >::get_muY2 ( ) const

Return the Y transversion rate.

template<class T >
std::vector< int > Population< T >::get_nb_children ( )

Returns a vector containing the number of children per individual.

template<class T >
std::vector< int > Population< T >::get_nb_mates ( )

Returns a vector containing the number of children per individual.

template<class T >
int Population< T >::get_nbFemale ( ) const

Returns the current number of female in the population.

template<class T >
int Population< T >::get_nbHuman ( ) const

Returns the current number of individuals in the population.

template<class T >
int Population< T >::get_nbMale ( ) const

Returns the current number of male in the population.

template<class T>
std::vector<T> Population< T >::get_pop ( int  current) const

Returns an array containing the individuals.

template<class T >
int Population< T >::get_sizeMt ( ) const

Returns the size - in number of sites - of the mtDNA sequence.

template<class T >
int Population< T >::get_sizePerX ( ) const

Returns the size - in number of sites - of sequences on X loci.

template<class T >
int Population< T >::get_sizePerA ( ) const

Returns the size - in number of sites - of sequences on autosome loci.

template<class T >
int Population< T >::get_sizeY ( ) const

Returns the size - in number of sites - of the X loci.

template<class T >
int Population< T >::get_crumbMt ( ) const

Returns the size of the array containing mtDNA in each individual.

template<class T >
int Population< T >::get_crumbX ( ) const

Returns the size taken by X chromosome in the nuclear DNA array in each individual.

template<class T >
int Population< T >::get_crumbY ( ) const

Returns the size taken by Y chromosome in the nuclear DNA array in each individual.

template<class T >
int Population< T >::get_crumbA ( ) const

Returns the size taken by autosomes in the nuclear DNA array in each individual.

template<class T >
int Population< T >::get_nbCellPerA ( ) const

Returns the size taken by one autosome locus in the nuclear DNA array in each individual.

template<class T >
int Population< T >::get_nbCellPerX ( ) const

Returns the size taken by one X locus in the nuclear DNA array in each individual.

template<class T >
int Population< T >::get_nbChromosomesX ( ) const

Returns the number of unlinked X loci.

template<class T >
int Population< T >::get_nbChromosomesA ( ) const

Returns the number of unlinked autosome loci.

template<class T >
Population< T > & Population< T >::operator= ( Population< T > const &  a)

Assignment operator.

template<class T >
void Population< T >::output_genealogy ( std::ofstream &  fs)

Output the genealogy of the population in a file. For each individual of each generation, the following line will be written:
generation ID IDmother IDfather
This file can be processed by a specific python script.

template<class T >
void Population< T >::output_nb_child ( )

Output the number of children for each individual per generation in the terminal.

template<class T >
void Population< T >::output_nb_mates ( )

Outputs the number of mates for each individual per generation in the terminal.

template<class T >
void Population< T >::get_growthFactor ( )

Return the demography parameters a,b,c. Defined as:
p(t+1) = a + b * p(t) + c * p(t)*p(t)

template<class T >
void Population< T >::output_pop_size ( ) const

Outputs the population size at each generation in the terminal.

template<class T>
double Population< T >::pairwise_distance_mtdna ( ) const

Computes the mean pairwise distance on the mtDNA sequence in the population.

template<class T>
typeDNA Population< T >::polySites ( int  nuclear) const

Returns the number of polymorphic sites on a given locus.

template<class T>
typeDNA Population< T >::polySites_mtdna ( ) const

Returns the number of polymorphic sites on the mtDNA sequence in the population.

template<class T >
void Population< T >::resize ( int  a)

Resizes the array containing the individuals. Done only once, after computing the maximum size of the population depending on the demographyc function.

template<class T >
void Population< T >::set_growthFactor ( double  a,
double  b,
double  c 
)

Changes the values a,b,c of the demography function.
p(t+1) = a + b*p(t) + c*p(t)*p(t)

template<class T >
void Population< T >::set_growthFactor ( std::vector< double >  a)

Changes the values a,b,c of the demography function. p(t+1) = a + b*p(t) + c*p(t)*p(t)

template<class T >
void Population< T >::set_inbreeding ( int  a)

Sets the value of the inbreeding parameter. If 1 individual sharing at least one parent can not mate.

template<class T >
void Population< T >::set_mu ( double  a,
double  b,
double  c,
double  d 
)

Set mutation rates : mtDNA, X, Y, autosomes

template<class T >
void Population< T >::set_mu ( double  a,
double  b,
double  c,
double  d,
double  e,
double  f,
double  g,
double  h 
)

Sets mutation rate : mtDNA transition, mtDNA transversion, X transition, X transversion, Y transition, Y transversion, austomomal transition, autosomal transversion.

template<class T >
Population< T > Population< T >::subsample ( int  sampleSize,
int  nbWomen 
)

>Returns a sample of the population (of type Population aswell) for a given sample size, with a given number of female in this sample.

template<class T >
Population< T > Population< T >::subsample_female ( )

>Returns a sample of the population (of type Population aswell) containing only the females.

template<class T >
Population< T > Population< T >::subsample_male ( )

>Returns a sample of the population (of type Population aswell) containing only the males.

template<class T>
void Population< T >::test ( int  )

Outputs the number of mates for each human in the command line.

template<class T>
void Population< T >::write_fasta ( std::string const &  file_name) const

Outputs the population in a Fasta formatted file.

template<class T>
void Population< T >::output_arlequin ( std::string const &  file_name) const

Outputs the population in a Arlequin formatted file.

template<class T>
void Population< T >::write_nexus ( std::string const &  file_name) const

Outputs the population in a Fasta formatted file.

template<class T>
void Population< T >::write_smartFormat ( std::string const &  filename) const

Outputs the population, with all its inidividuals and their DNA / mtDNA sequences in a special format. SMARTPOP can later read this file to reload the population.

template<class T >
void Population< T >::write_txt_pop ( std::string const &  file_name) const

Starts a cycle of a given number of generations to evolve.

Member Data Documentation

template<class T>
std::vector<T> Population< T >::female[2]

Vector containing all the female of the current generation, and of the previous (in phases before reproduction) or the next generation (in phases after reproduction).

template<class T>
std::vector<T> Population< T >::male[2]

Vector containing all the female of the current generation, and of the previous (in phase before reproduction) or the next generation (in phases after reproduction).


The documentation for this class was generated from the following file:

SMARTPOP home