Description Usage Arguments Value Examples
View source: R/sim_single_locus.R
The function proceeds as follows:
For each of the ancestors, using the ancestor's population index, draw two alleles randomly from the ancestor's population allele frequency.
Based on Mendelian Inheritance, for each generation, randomly and with equal probability draw one allele from the mother and one allele from the father. Therefore, each generation there will half the number of people/allele pairs.
Proceed until there is only one sample left.
1 | sim_single_locus(ancestor_pop_label, allele_freq)
|
ancestor_pop_label |
A vector of integers giving the highest level of the family tree, which consists only of ancestors from pure genetic populations. Integers index the population, with order given by the order in which the population dominant allele frequencies are provided in the input allele frequencies file. |
allele_freq |
A list of vectors of the population allele frequencies. Index must match the index of |
A matrix with two rows and a single column. The elements correspond to the two alleles for the resulting genotype at the given SNP. The values are either 1 or 2, and correspond to the two variants in order of the supplied allele frequency vectors.
1 2 3 4 5 6 | #Single grandparent:
sim_single_locus(
ancestor_pop_label = c(2,1,1,1),
allele_freq = list(
c(0.1,0.9),c(0.9,0.1)
))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.