Egglib 2.1.11
C++ library reference manual
Public Member Functions | List of all members
Mutator Class Reference

Implements mutation models. More...

#include <Mutator.hpp>

Public Member Functions

 Mutator ()
 Initializes with default values. More...
 
 ~Mutator ()
 Destroys the object. More...
 
 Mutator (const Mutator &)
 Copy constructor. More...
 
Mutatoroperator= (const Mutator &)
 Assignement operator. More...
 
void reset ()
 Restores default values of all parameters. More...
 
unsigned int fixedNumberOfMutations () const
 Gets the fixed number of mutations. More...
 
void fixedNumberOfMutations (unsigned int)
 Sets the fixed number of mutations. More...
 
double mutationRate () const
 Gets the mutation rate. More...
 
void mutationRate (double)
 Sets the mutation rate. More...
 
char mutationModel () const
 Gets the mutation model. More...
 
void mutationModel (char)
 Sets the mutation model. More...
 
unsigned int numberOfAlleles () const
 Gets the fixed number of possible alleles. More...
 
void numberOfAlleles (unsigned int)
 Sets the fixed number of possible alleles. More...
 
void transitionWeight (unsigned int i, unsigned int j, double value)
 Sets a transition weight. More...
 
double transitionWeight (unsigned int i, unsigned int j)
 Gets a transition weight. More...
 
void randomAncestralAllele (bool flag)
 Set to true to draw ancestral alleles randomly. More...
 
bool randomAncestralAllele () const
 true if ancestral alleles must be drawn randomly More...
 
double TPMproba () const
 Gets the TPM probability parameter. More...
 
void TPMproba (double value)
 Sets the TPM probability parameter. More...
 
double TPMparam () const
 Gets the TPM distribution parameter. More...
 
void TPMparam (double value)
 Sets the TPM distribution parameter. More...
 
unsigned int numberOfSites () const
 Gets the number of mutable sites. More...
 
void numberOfSites (unsigned int)
 Sets the number of mutable sites. More...
 
double sitePosition (unsigned int siteIndex) const
 Gets the position of a given site. More...
 
void sitePosition (unsigned int siteIndex, double position)
 Set the position of a given site. More...
 
double siteWeight (unsigned int siteIndex) const
 Gets the mutation weight of a given site. More...
 
void siteWeight (unsigned int siteIndex, double weight)
 Set the site weight of a given site. More...
 
DataMatrix mute (Arg *arg, Random *random)
 Performs mutation. More...
 
unsigned int numberOfMutations () const
 Gets the last number of mutations. More...
 

Detailed Description

Implements mutation models.

Works with a previously built Ancestral Reconbination Graph. The user must sets options using the setter-based interface. After that he or she can call the method mute() that will generates a DataMatrix object.

Genotype data are represented by integer numbers. Regardless of the mutation model, the ancestral state is always 0. The user can set the rate of mutation (or, alternatively, fix the number of mutations that occurred - which is the number of segregating sites only with an infinite site model).

Other options fall into two separate groups: the positions of the mutated sites and the process of mutation (how new alleles are generated).

Concerning allele generation, several mutation models are available (coded by single letters):

By default, the program will assume an infinite site model (ISM). Each mutation will occur to a new position drawn from the interval [0,1]. It is possible to set any mutation model with an ISM (including microsatellite-like models I, S and T). Alternatively, the user can specify a finite number of sites available for mutation. For a microsatellite marker, the user will want to specify a single site. It is possible to set a finite number of sites for all mutation models. In all cases, the mutations will be forced to target these sites. It is possible to apply weights independently to all sites. The higher the weight value (comparatively to the other sites), the higher the probability that this site mutes. The weights needs not to be relative. In addition, the user can set the positions of the different sites. Nothings forces him or her to place them in order. Note that this does not affect the mutation process, but on the amount of recombination that will be allowed between sites.

Constructor & Destructor Documentation

Mutator ( )

Initializes with default values.

List of default values:

  • theta = 0
  • fixedNumberOfMutations = 0
  • model = F (fixed number of alleles)
  • fixed number of alleles = 2
  • infinite site model
  • TPM parameters are both preset to 0.5
~Mutator ( )

Destroys the object.

Mutator ( const Mutator src)

Copy constructor.

Member Function Documentation

unsigned int fixedNumberOfMutations ( ) const

Gets the fixed number of mutations.

void fixedNumberOfMutations ( unsigned int  value)

Sets the fixed number of mutations.

The value can be 0. It is not allowed to set both the fixed number of mutations and the mutation rate at non-zero value

char mutationModel ( ) const

Gets the mutation model.

See the class documentation for the signification of the different one-letter codes.

void mutationModel ( char  value)

Sets the mutation model.

The passed character must be one of F, I, S and T. See the class documentation for their signification.

double mutationRate ( ) const

Gets the mutation rate.

void mutationRate ( double  value)

Sets the mutation rate.

The value cannot be negative. The value can be 0. It is not allowed to set both the fixed number of mutations and the mutation rate at non-zero value

DataMatrix mute ( Arg arg,
Random random 
)

Performs mutation.

Parameters
argAncestral recombination graph instance. If the ARG is partially built or not a all, or improperly so, the behaviour of this method is not defined.
randomThe address of a Random instance to be used for generating random numbers.
Returns
A DataMatrix instance containing simulated data.
unsigned int numberOfAlleles ( ) const

Gets the fixed number of possible alleles.

void numberOfAlleles ( unsigned int  value)

Sets the fixed number of possible alleles.

The value must be larger than 1. This parameter is meaningful only for the fixed number allele model of mutation, and ignored otherwise.

unsigned int numberOfMutations ( ) const

Gets the last number of mutations.

Returns the number of mutations of the last call of mute( ). By default, this method returns 0.

unsigned int numberOfSites ( ) const

Gets the number of mutable sites.

A value a zero must be interpreted as the infinite site model. Note that after all calls all data from the tables sitePositions and siteWeights will be reset.

void numberOfSites ( unsigned int  value)

Sets the number of mutable sites.

The value of zero is accepted and imposed the infinite site model.

Mutator & operator= ( const Mutator src)

Assignement operator.

void randomAncestralAllele ( bool  flag)

Set to true to draw ancestral alleles randomly.

By default, the ancestral allele is always 0. If this variable is set to true, the ancestral allele will be randomly drawn from the defined number of alleles. This option is always ignored unless in combination with the Fixed Allele Number model.

bool randomAncestralAllele ( ) const

true if ancestral alleles must be drawn randomly

void reset ( )

Restores default values of all parameters.

double sitePosition ( unsigned int  siteIndex) const

Gets the position of a given site.

void sitePosition ( unsigned int  siteIndex,
double  position 
)

Set the position of a given site.

The position must be >=0 and <=1

double siteWeight ( unsigned int  siteIndex) const

Gets the mutation weight of a given site.

void siteWeight ( unsigned int  siteIndex,
double  weight 
)

Set the site weight of a given site.

The weight must be strictly positive.

double TPMparam ( ) const

Gets the TPM distribution parameter.

void TPMparam ( double  value)

Sets the TPM distribution parameter.

This parameter is considered only if the mutation model is T (two-phase mutation model). It gives the parameter of the geometric distribution which is used to generate the mutation step (if it is not one).

The value must be >=0. and <=1.

double TPMproba ( ) const

Gets the TPM probability parameter.

void TPMproba ( double  value)

Sets the TPM probability parameter.

This parameter is considered only if the mutation model is T (two-phase mutation model). It gives the probability that a mutation step is not fixed to be 1. If TPMproba is 0, the mutation model is SMM.

The value must be >=0. and <=1.

void transitionWeight ( unsigned int  i,
unsigned int  j,
double  value 
)

Sets a transition weight.

Parameters
irow (previous allele index).
jcolumn (next allele index).
valueweight to apply.

Indices i and j must be different. Weights can be any strictly positive value.

double transitionWeight ( unsigned int  i,
unsigned int  j 
)

Gets a transition weight.

Parameters
irow (previous allele index).
jcolumn (next allele index).

Indices i and j must be different.


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

Hosted by 
Get EggLib at SourceForge.net. Fast, secure and Free Open Source software downloads