poolne_estim_boot_pi: Parametric bootstrap of 'poolne_estim' allele frequencies

View source: R/poolne_estim_boot_pi.R

poolne_estim_boot_piR Documentation

Parametric bootstrap of poolne_estim allele frequencies

Description

Takes the results of poolne_estim (Gautier et al. 2013) and performs a parametric bootstrap of Ref allele frequencies based on their pi (estimated Ref allele frequency) and sd (the standard deviation).

Usage

poolne_estim_boot_pi(dat, num.sims = 100)

Arguments

dat

Data table: the poolne_estim data. For example, the output from genomalicious::poolne_estim_output(). Requires 4 columns:

  1. $POOL, the population pool ID.

  2. $LOCUS, the locus ID.

  3. $PI, the estimated population frequency for the Ref allele.

  4. $SD, the standard deviation for PI.

num.sims

Numeric, the number of simulations to generate. Default = 100.

Details

The values of PI and SD in dat are used to generate the alpha and beta paramters of a beta distribution, where:

alpha = ((1 - Mu) / Var - 1 / Mu) * Mu ^ 2
beta = alpha * (1 / Mu - 1)

Here, values of dat$PI take on the values of Mu (the mean) and (dat$SD)^2 take on the values of Var (the variance).

From the resulting beta distribution, num.sims values are drawn to create a distribution of possible allele frequencies (for each locus) that might exist in the sampled populations (given the associated mean and error estimated by poolne_estim).

Value

A data table, with the following columns:

  1. $POOL, the population pool ID.

  2. $LOCUS, the locus ID.

  3. $BOOT.NUM, the simulation number.

  4. $BOOT.PI, the simulated pi (Ref allele frequency).

Examples

# Create a link to raw external datasets in genomalicious
genomaliciousExtData <- paste0(find.package('genomalicious'), '/extdata')

# Get the poolne estimat pi estimates
pi.data <- poolne_estim_output(stat='pi', datDir=genomaliciousExtData, lociDir=genomaliciousExtData)

# Simulate potential distributions
pi.sims <- poolne_estim_boot_pi(pi.data, 100)
pi.sims


j-a-thia/genomalicious documentation built on Oct. 19, 2024, 7:51 p.m.