Simulating Mating Alliances as a Reproductive Tactic for Populations
 All Classes Functions Variables Friends
Public Member Functions | List of all members
Simulation Class Reference

Public Member Functions

 Simulation (unsigned randomSeed)
 
 Simulation (Simulation const &)
 
 ~Simulation ()
 
Simulationoperator= (Simulation const &)
 
int run ()
 
int print_help ()
 
void load_file (std::string)
 
void load_directory (std::string)
 
void export_file (std::string filename)
 
void set_seed (int)
 
void set_popsize (int)
 
void set_sample (int)
 
void set_step (int)
 
void set_nstep (int)
 
void set_matsys (int)
 
void set_inbreeding (int)
 
void set_nSimu (int)
 
void set_sizeMt (int)
 
void set_sizeY (int)
 
void set_sizePerX (int)
 
void set_sizePerA (int)
 
void set_nbLociA (int)
 
void set_nbLociX (int)
 
void set_mu (double, double)
 
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_burninT (double)
 
void set_dnaComplexity (int a)
 
void set_diversityX (int a)
 
void set_fileoutput (std::string)
 
void set_verbose_on ()
 
void set_fasta_on ()
 
void set_save_on (std::string dirName)
 
void set_arlequin_on ()
 
void set_genealogy_on ()
 
void set_header_on ()
 
int get_nSimu ()
 
bool get_verbose ()
 
void header_write ()
 
void check_parameters ()
 

Constructor & Destructor Documentation

Simulation::Simulation ( unsigned  randomSeed)
explicit

Constructor from the random seed. This constructor is the one called in the normal set of simulations.

Simulation::Simulation ( Simulation const &  a)

Constructor of copy.

Simulation::~Simulation ( )

Destructor.

Member Function Documentation

void Simulation::check_parameters ( )

Checks the parameters are meaningful before starting the simulation. E.g. sample size must be smaller than population size.

void Simulation::export_file ( std::string  filename)

Outputs a file with all the parameters set for the simulations. By default it will be called SMARTPOP_parameters.txt.

int Simulation::get_nSimu ( )

Returns the number of simulations.

bool Simulation::get_verbose ( )

Returns the verbose value (true or false).

void Simulation::header_write ( )

Writes the header at the beginning of the different diversity files. It checks which files will be later created.

void Simulation::load_directory ( std::string  )

Loads files containing the data from a previous simulation set. WARNING : for parallel processes the new call must start the same number of process that the previous one!

void Simulation::load_file ( std::string  )

Loads a file containing parameters to start a simulation. This method is an alternative to the input of parameters in command lines. The file must be in the same format as SMARTPOP_parameters.txt which is created automatically. If a keyword is missing, the parameter will take it default its default value.

Simulation & Simulation::operator= ( Simulation const &  a)

Assignment operator.

int Simulation::print_help ( )

Outputs the help in command lines. It is called by default if the simulation set does not start.

void Simulation::set_arlequin_on ( )

Creates an Arlequin file for each population at the end of the simulation.

void Simulation::set_burninT ( double  a)

Sets the diversity threshold to be reached by the burnin phase. The maximum number of generations that the burnin phase runs can not be change in input, but in the code instead.

void Simulation::set_diversityX ( int  a)

Set on which DNA the diversity will be computed:
0 for mtDNA + X + Y + autosome
1 for mtDNA autosome
2 for X
3 for Y
4 for autosome
These numbers are stored in a vector to allow combination such as mtDNA + X.

void Simulation::set_dnaComplexity ( int  a)

Set the complexity of the DNA that will be simulated.
0 for mtDNA, X, Y, and austosomes
1 for mtDNA only (faster)
2 for no DNA at all (if you only want to look at genealogy).

void Simulation::set_fasta_on ( )

Activates the output of a fasta file for each population at the end of the simulation.

void Simulation::set_fileoutput ( std::string  )

Sets the name of the file for the outputs. All the output will have the same root name with different suffix.

void Simulation::set_genealogy_on ( )

Saves the entire genealogy of all the populations. Create a file (.gene) with each inidvidual information on one line:
generation ID IDmother IDfather

void Simulation::set_growthFactor ( double  a,
double  b,
double  c 
)

Sets the demography parameters. The demography is defined a as discrete process:
p(t+1) = a + b*p(t) + c*p(t)*p(t)
For a constant population: a=0, b=1 , c=0.
For an exponentially growing (/decreasing) population : a=0, b>1 (b<1), c=0.
For a constant growth (decrease): a>0, b=1, c=0.

void Simulation::set_header_on ( )

Sets the parameter to write the header at the top of the diversity file.

void Simulation::set_inbreeding ( int  a)

Set inbreeding scheme :
0 all accepted.
1 alliances forbidden between siblings.

void Simulation::set_matsys ( int  a)

Set the mating system:
1 : monogamy
2 : polygamy
3 : polgyny
4 : polyandry

void Simulation::set_mu ( double  a,
double  d 
)

Sets two mutation rates : transition and transversion.

void Simulation::set_mu ( double  a,
double  b,
double  c,
double  d 
)

Sets four mutation rates : mtDNA, X chromsome, Y chromosome, autosomes.

void Simulation::set_mu ( double  a,
double  b,
double  c,
double  d,
double  e,
double  f,
double  g,
double  h 
)

Sets 8 mutation rates : mtDNA transition, mtDNA transversion, X transition, X transversion, Y transition, Y transversion, autosomal transition, autosomal transversion.

void Simulation::set_nSimu ( int  a)

Sets the number of parameters to be run with the exact same set of parameters.

void Simulation::set_nstep ( int  a)

Sets the number of sampling through time.

void Simulation::set_popsize ( int  a)

Sets the population size at the start.

void Simulation::set_sample ( int  a)

Sets the sample size.

void Simulation::set_save_on ( std::string  dirName)

Activates the save of each population at the end of each populaton in a SMARTPOP formatted file which can be loaded later on. All the files containing the population (.sim) will start with the name inputted in the function.

void Simulation::set_seed ( int  a)

Sets the random seed.

void Simulation::set_sizeMt ( int  a)

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

void Simulation::set_sizeY ( int  a)

Sets the size - in number of sites - of the Y chromosome sequence.

void Simulation::set_sizePerX ( int  a)

Sets the size - in number of sites - of the sequence of each X locus. All X loci will have the same lenght.

void Simulation::set_sizePerA ( int  a)

Sets the size - in number of sites - of the sequence of each autosome locus. All autosome loci will have the same lenght.

void Simulation::set_nbLociA ( int  a)

Sets the number of unlinked loci on the autosomes.

void Simulation::set_nbLociX ( int  a)

Sets the number of unlinked loci on the X chromosome.

void Simulation::run ( )

Main function. It is called for every set of simulations after the parameters have been set.

void Simulation::set_step ( int  a)

Sets the number of generations to evolve between two sampling.

void Simulation::set_verbose_on ( )

Changes the parameter verbose to true. The program will then output a lot of informations in the terminal.


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

SMARTPOP home