draw_p_anc: Draw random Uniform or Beta ancestral allele frequencies

Description Usage Arguments Value Examples

View source: R/draw_p_anc.R

Description

This is simply a wrapper around stats::runif() or stats::rbeta() (depending on parameters) with different defaults and additional validations.

Usage

1
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

1
2
3
4
5
6
7
# 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 documentation built on Aug. 25, 2021, 5:07 p.m.