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

make_p_ind_admix

Construct individual-specific allele frequency matrix under the PSD admixture model


Description

Here m is the number of loci, n the number of individuals, and k the number of intermediate subpopulations. The m-by-n individual-specific allele frequency matrix p_ind is constructed from the m-by-k intermediate subpopulation allele frequency matrix p_subpops and the n-by-k admixture proportion matrix admix_proportions equivalent to p_ind <- p_subpops %*% t( admix_proportions ). This function is a wrapper around \link{tcrossprod}, but also ensures the output allele frequencies are in [0, 1] (otherwise not guaranteed due to limited machine precision).

Usage

make_p_ind_admix(p_subpops, admix_proportions)

Arguments

p_subpops

The m-by-k matrix of intermediate subpopulation allele frequencies.

admix_proportions

The n-by-k matrix of admixture proportions.

Value

The m-by-n matrix of individual-specific allele frequencies p_ind.

Examples

# data dimensions
# number of loci
m_loci <- 10
# number of individuals
n_ind <- 5
# number of intermediate subpops
k_subpops <- 2

# FST values for k = 2 subpops
inbr_subpops <- c(0.1, 0.3)

# non-trivial admixture proportions
admix_proportions <- admix_prop_1d_linear(n_ind, k_subpops, sigma = 1)

# random vector of ancestral allele frequencies
p_anc <- draw_p_anc(m_loci)

# matrix of intermediate subpop allele freqs
p_subpops <- draw_p_subpops(p_anc, inbr_subpops)

# matrix of individual-specific allele frequencies
p_ind <- make_p_ind_admix(p_subpops, admix_proportions)

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.