# newborns: Genetic structure of newborns In eriqande/glads: Genomic Landscape of Divergence Simulation

 newborns R Documentation

## Genetic structure of newborns

### Description

This function generates the genetic structure of the generation of newborns.

### Usage

newborns(x, recombination, type)


### Arguments

 x List of demographic and genetic parameter values (see Details). recombination Type of recombination between homologous chromosomes. Current options are 'map' and 'average' (see Details). type Type of simulated evolution. Current options are 'constant', 'dynamic', 'additive', and 'custom' (see Details).

### Details

The function is used internally in the function evolve() in order to generate the genetic structure of the newborns of each generation. A three-dimensional array is returned. Rows represent individuals and columns the different loci. Each element of the array is an integer defining the copy of a given allele at a given locus. The third dimension of the array has two layers representing a pair of homologous chromosomes.

The following parameter should be included as a list of parameters 'x':

• struct: An object of class "struct" with the genetic structure of each individual in the population.

• recom.rate: A numerical value of the per-base-pair recombination rate (for example, 1e-08) for recombination type 'average' or a vector of nl - 1 elements with the recombination rate between neigbour loci for type 'map' (nl: number of loci).

• init.sex: A vector defining the sex of the initial individuals in the populations (1: females and 2: males). The default value is NULL and assign the sex of the first generation randomly.

• mutation.rate: Mutation rate of biallelic loci.

• loci.pos: A vector with the position of loci. The default value is NULL, but it is required for recombination type 'average'.

• chromo_mb: A numerical value with the size of the simulated chromosome (in megabase). The default value is NULL, but it is required for recombination type 'average'.

• param.z: A list with the parameter values for the function computing phenotypes.

• param.w: A list with the parameter values for the fitness function.

Different types of evolution are available for simulations:

• 'constant' a constant population size over time. There is no selection, equal sex ratio and each breeding pair generates two offspring. This case represent neutral evolution in which variation are due to recombination, mutation and migration. Variations in the population sizes are also possible due to the effect of migration.

• 'dynamic' a dynamic population size over time. This type of evolution introduces to type 'constant' an unequal sex ratio, a variable number of offspring and a density-dependent demographic effect to avoid exponential growth. A list with the parameters for the phenotype function (param.z=list(sex.ratio)) and for the fitness function (param.w=list(mean.fitness, d.d)) are required:

• sex.ratio: a numerical value defining the sex ratio of populations. This value should be included within a list in 'param.z'.

• mean.fitness: an integer with the mean number of offsprings generated by breeding pair. This value should be included within a list in 'param.w'.

• d.d: numerical value introducing the density-dependent demographic effect to avoid exponential growth. This value should be included within a list in 'param.w'.

The sex of individuals (1: females and 2: males) are generated by a binomial distribution with probability of being a male equal to the 'sex.ratio' The fitness of individuals (in number of offspring) are obtained from: Poisson(λ) - N*d.d, in which λ is equal to 'mean.fitness' and N represents the population size.

• 'additive' additive phenotype evolution. This function introduce quantitative phenotypes and convergent or divergent selection as implemented in Quilodrán et al. (2019). A list with the parameters for the phenotype function (param.z=list(sex.ratio, fitness.pos, bvs, add.loci, e.v)) and for the fitness function (param.w=list(b0,b1,b2,b3, d.v, add.loci)) are required.

The following parameters are needed for the computation of phenotypes (z):

• sex.ratio: A numerical value defining the sex ratio of populations. This value should be included within a list in 'param.z'.

• fitness.pos: A vector with the position of the additive loci participating in the computation of phenotypes. This value should be included within a list in 'param.z'.

• bvs: A matrix with the breeding values of alleles on each loci. The number of rows is equal to the number of additive loci, while the number of columns is equal to the maximum number of alleles in a locus. This object should be included within a list in 'param.z'.

• add.loci: An integer with the total number of additive loci participating in the computation of phenotypes. This object should be included within a list in 'param.z'.

• e.v: A numerical value defining a stochastic environmental variant in the computation of phenotypes. This value should be included within a list in 'param.z'.

The default phenotype function (z) focus on an additive genetic genotype-phenotype map. Therefore, the sum of values of alleles at each locus gives a breeding value (b_v) for each individual at a given locus. The sum of breeding values bvs across loci gives a breeding value for the phenotypes (z), which is computed as follows:

z = ∑_{v =1 }^{n_a} b_v + \varepsilon_e(0, σ_e)

Where n_a is equal to 'add.loci' and σ_e is equal to 'e.v'. The environmental contribution \varepsilon_e is assumed to be stochastic and normally distributed, with a mean of 0 and standard variation 'e.v'. This function returns a data.frame with rows equal to the number of individuals and two columns ('sex' and 'z')

The default fitness function (ω) computes a Gaussian relationship between z and ω. The following parameters are needed:

• b0: A numerical value defining the maximum number of offspring generated by breeding pair. This value should be included within a list in 'param.w'.

• b1: A numerical value defining the phenotypic optima. In the gaussiam relationship between z and ω, the value of 'b1' represent the z value expected to produce the maximum number of offspring. This value should be included within a list in 'param.w'. The difference in phenotypic optima between the populations drives the strength of 'divergent selection'. Populations exposed to equal phenotypic optima are considered to be under 'concordant selection'.

• b2: A numerical value defining the variance of the Gaussian curve. This value should be included within a list in 'param.z'.

• b3: A numerical value defining the intensity of the density-dependence on the fitness of individuals in a population of size N. This value should be included within a list in 'param.w'.

• d.v: A numerical value defining a stochastic demographic variant in the fitness of individuals. This value should be included within a list in 'param.w'.

• add.loci: An integer with the total number of additive loci participating in the computation of phenotypes. This object should be included within a list in 'param.w'.

The default fitness function (ω) has the form:

ω = b_0 \exp^{ -\frac{1}{2} ≤ft ( \frac{4z - b_1n_a}{b_2n_a} \right )^2} - b_3N + \varepsilon_d(0, σ_d )

Where n_a is equal to 'add.loci', N is the population size and σ_d is equal to 'd.v'. The demographic variant \varepsilon_d is assumed to be stochastic and normally distributed, with a mean of 0 and standard variation 'd.v'. This function returns a vector with the fitness value (ω) of individuals.

• 'custom' a custom computation of phenotypes and fitness functions. This functions will defined the type of selection fitting particular case studies. Either a function called 'phenotype' or 'fitness' should be introduced into the namespace, with parameter values included in param.z or param.w. Assuming a per generation time step, the potential number of offspring produced by each individual depends on its phenotype ω = f(z), which in turn depends on the individual genotype and on the environment z = g(G, E). G is a numeric value determined by an individual’s genotype, representing the genetic value of the genotype. In the case of an additive genetic map, the genetic value of a genotype will be a breeding value. E represents the effect of the environment on phenotypic expression, and this allows to capture the effects of plasticity on phenotypic expression. The list of parameters ('param.z' and 'param.w') used for the custom 'phenotype' or 'fitness' function should not include variables. In the first case, the variable phenotype values of individuals are already loaded in the working space as 'z', as well as the genetic structure of each individual in a population, included as the object 'struct' (see Examples).

The recombination between homologous chromosomes are either of type 'map' or 'average'. The first case needs a vector with the recombination rate (ρ) between neigbour loci of length equal to nl - 1 (nl: number of loci). The probability of having a crossover (1) or not (0) is uniformly distributed at a rate defined by the value of ρ between loci (i.e. positions with a probability smaller than ρ recombine). The uniform distribution allows each position with the same values of ρ to have an equal chance of crossover across all iterations. There is no recombination between homologous chromosomes when ρ = 0, both loci are completely linked (e.g. within an inversion or situated close to centromeres), while with a value of ρ = 0.5, the recombination rate is completely random (i.e. both loci are very distant on the same chromosome or are located on different chromosomes). A value of ρ < 0.5 means the loci are physically linked. The second case, when recombination is of type 'average', a numerical value with the average recombination rate per base pair should be supplied, the loci position and the size of the chromosome in megabase are also required. The crossover points are exponentially distributed as a Poisson process (see Example).

### Value

An object of class "struct" or an array.

evolve