sim_pop: Simulate population structure

View source: R/sim_pop.R

sim_popR Documentation

Simulate population structure

Description

This function defines admixture and optionally family parameters establishing how individuals are related to each other. Admixture proportions are deterministically constructed from the linear 1D admixture model bnpsd::admix_prop_1d_linear(). If fst < 0.5 the intermediate inbreeding coefficients are proportional to their index (1:k_subpops), otherwise they are proportional to (1:k_subpops) + 1. If G > 1, a random family structure is drawn using simfam::sim_pedigree(). No per-locus parameters are constructed or simulated with this function.

Usage

sim_pop(
  n_ind = 1000,
  k_subpops = 3,
  bias_coeff = 0.5,
  fst = 0.3,
  G = 1,
  verbose = TRUE
)

Arguments

n_ind

The number of individuals.

k_subpops

The number of intermediate subpopulations for admixture model.

bias_coeff

The bias coefficient of the admixed individuals (for the founders if G > 1).

fst

The FST of the admixed individuals (for the founders if G > 1).

G

The number of generations for random family. The G = 1 case is no family structure (just admixture). For G > 1 first admixed founders are simulated, then the family structure is simulated from them.

verbose

If TRUE reports progress, otherwise it is silent.

Value

A list containing the following elements:

  • admix_proportions_1: The true admixture proportions of the founders (required to draw genotypes for admixed founders and seed the family structure if G > 1)

  • admix_proportions: The true admixture proportions of the joint admixed family model (final generation only).

  • inbr_subpops: The vector of intermediate subpopulation inbreeding/FST values for admixture model.

  • fam: If G > 1, the pedigree structure as a plink FAM table, pruned with simfam::prune_fam() to include only ancestors of the final generation; otherwise NULL.

  • ids: If G > 1, a list of IDs from fam above split into non-overlapping generations; otherwise NULL.

  • kinship: The true kinship of the joint admixed family model (final generation only).

See Also

The bnpsd and simfam packages.

Examples

# a small example
data_pop <- sim_pop( n_ind = 50, G = 3 )

# parameters for admixture model of founders
data_pop$admix_proportions_1
data_pop$inbr_subpops

# parameters of family structure
data_pop$fam
data_pop$ids

# parameters for final generation
data_pop$admix_proportions
data_pop$kinship


OchoaLab/simgenphen documentation built on Feb. 10, 2023, 3:32 p.m.