Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

draw_p_anc

Draw random Uniform or Beta ancestral allele frequencies


Description

This is simply a wrapper around \link[stats]{runif} or \link[stats]{rbeta} (depending on parameters) with different defaults and additional validations.

Usage

draw_p_anc(m_loci, p_min = 0.01, p_max = 0.5, beta = NA)

Arguments

m_loci

Number of loci to draw.

p_min

Minimum allele frequency to draw (Uniform case only).

p_max

Maximum allele frequency to draw (Uniform case only).

beta

Shape parameter for a symmetric Beta. If NA (default), Uniform(p_min, p_max) is used. Otherwise, a Symmetric Beta is used and the user-specified range is ignored (values in [0, 1] will be returned).

Value

A length-m vector of random ancestral allele frequencies

Examples

# Default is uniform with range between 0.01 and 0.5
p_anc <- draw_p_anc(m_loci = 10)

# Use of `beta` triggers a symmetric Beta distribution.
# This parameter has increased density for rare minor allele frequencies,
# resembling the 1000 Genomes allele frequency distribution
p_anc <- draw_p_anc(m_loci = 10, beta = 0.03)

bnpsd

Simulate Genotypes from the BN-PSD Admixture Model

v1.2.3
GPL-3
Authors
Alejandro Ochoa [aut, cre] (<https://orcid.org/0000-0003-4928-3403>), John D. Storey [aut] (<https://orcid.org/0000-0001-5992-402X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.