Description Usage Arguments Details Value Author(s) References See Also Examples
Functions to calculate the frequencies of single-locus genotypes, the frequencies of single-locus alleles and the frequencies of multi-locus gametes. The input is the vector of numbers of individuals at each multilocus genotype.
1 2 3 | freq_genotypes(N, init.par)
freq_alleles(N, init.par, fG = NULL)
freq_gametes(N, init.par)
|
N |
Vector (1-D array) giving the number of individuals of each multilocus genotype. Typically this is obtained from the output of a multilocus simulation by subsetting a single deme / age class / time step. See the example. |
init.par |
A list of arguments necessary to initialize the simulations and obtained with the function initialize.monoecious.multilocus. It must be the same list that has been used to simulate |
fG |
The genotype frequencies that will be used to the calculate allele frequencies: the output of |
When the recombination rate r
= 0.5, the loci are independent and MetaPopGen uses a memory-efficient storing method for genotypes that does not consider phasing ("locus-based" method, see Andrello et al. under review). For example, the two genotypes A1B1/A2B2 and A1B2/A2B1 are pooled into the same genotype A1B1/A2B2 because they are equivalent in terms of multi-locus gamete production. The computation of gamete frequencies is affected by this loss of information, as the A1B1/A2B2 genotype could be formed i) by gametes A1B1 and A2B2 (with probability 0.5) or ii) by gametes A1B2 and A2B1 (with probability 0.5). The gamete counts obtained by freq_gametes
are calculated considering these probabilities, thus might not be integers. Conversely, when r
< 0.5 (linked loci), the loci are non-independent (linked) and MetaPopGen uses a storing method for genotypes that considers phasing ("gamete-based" method). In this case, the gamete counts obtained by freq_gametes
are calculated by counting the gametes forming the phased genotypes and are always integers.
For freq_genotypes
, a list with two components. The first component ($counts
) is itself a list giving the genotype counts for each single-locus genotype at each locus. The second component ($frequencies
) is like the first one, but giving frequencies instead of counts.
For freq_alleles
: as for freq_genotypes
, but giving allele counts and allele frequencies instead of genotype counts and genotype frequencies.
For freq_gametes
, a list with two components. The first component ($counts
) is a vector of gamete counts and the second component ($frequencies
) is a vector of gamete frequencies.
Marco Andrello
Andrello M, Noirot C, Debarre F and Manel S. (under review). METAPOPGEN 2.0: a multi-locus genetic simulator to model populations of large size. Molecular Ecology Resources **Issue**, pp-pp.
freq.all
to calculate allele frequencies in single-locus simulations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
data(MultilocusMonoecious)
N <- sim.metapopgen.monoecious.multilocus(init.par=init.par,
sigma=sigma,
phi_F=phi_F, phi_M=phi_M,
delta.prop=delta.prop, delta.ad=delta.ad,
T_max=T_max)
# Subsetting to get results from deme 1, age class 1 at time 3
N_deme1_age1_time3 <- N[,1,1,3]
# Genotype frequencies
fG <- freq_genotypes(N_deme1_age1_time3, init.par)
fG$counts
fG$frequencies
# Allele frequencies
fA <- freq_alleles(N_deme1_age1_time3, init.par)
# Equivalent but a bit faster:
fA <- freq_alleles(N_deme1_age1_time3, init.par, fG)
# Gamete frequencies
fgam <- freq_alleles(N_deme1_age1_time3, init.par)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.