View source: R/draw_all_unstructured.R
draw_all_unstructured | R Documentation |
This function returns simulated ancestral allele frequencies and genotypes without structure, meaning individuals draw their genotypes independently and identically from the Binomial distribution with the same ancestral allele frequency per locus.
The function is a wrapper around draw_p_anc()
with additional features such as requiring polymorphic loci, mimicking draw_all_admix()
in options as applicable.
Importantly, by default fixed loci (where all individuals were homozygous for the same allele) are re-drawn from the start (starting from the ancestral allele frequencies) so no fixed loci are in the output.
Below m_loci
(also m
) is the number of loci and n_ind
is the number of individuals.
draw_all_unstructured(
n_ind,
m_loci = NA,
beta = NA,
p_anc = NULL,
require_polymorphic_loci = TRUE,
maf_min = 0,
verbose = TRUE
)
n_ind |
The number of individuals to draw (required). |
m_loci |
The number of loci to draw. Required except when |
beta |
Shape parameter for a symmetric Beta for ancestral allele frequencies |
p_anc |
If provided, it is used as the ancestral allele frequencies (instead of drawing random ones). Must either be a scalar or a length- |
require_polymorphic_loci |
If |
maf_min |
The minimum minor allele frequency (default zero), to extend the working definition of "fixed" above to include rare variants.
This helps simulate a frequency-based locus ascertainment bias.
Loci with minor allele frequencies less than or equal to this value are treated as fixed (passed to |
verbose |
If |
A named list with the following items (which may be missing depending on options):
X
: An m_loci
-by-n_ind
matrix of genotypes.
p_anc
: A length-m_loci
vector of ancestral allele frequencies.
# dimensions
# number of loci
m_loci <- 10
# number of individuals
n_ind <- 5
# draw all random allele freqs and genotypes
out <- draw_all_unstructured( n_ind, m_loci )
# return value is a list with these items:
# genotypes
X <- out$X
# ancestral AFs
p_anc <- out$p_anc
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.