SimulatePop: Simulate an admixed polyploid population characterized for...

View source: R/SimulatePop.R

SimulatePopR Documentation

Simulate an admixed polyploid population characterized for multi-allelic markers

Description

This function simulates a polyploid admixed population

Usage

SimulatePop(
  K = 3L,
  N = 100L,
  P = 6L,
  M = 1000L,
  C = 5L,
  L = 10L,
  SmoothParam = 1,
  GeneticMap = NULL,
  Prop = NULL,
  Freq = NULL,
  AlphaProp = 1,
  AlphaFreq = 1,
  Depth = NULL,
  SeqError = 0.01,
  NbThreads = 0L,
  Seed = 123L
)

Arguments

K

Number of ancestral groups (positive integer superior or equal to 2)

N

Number of individuals (positive integer superior or equal to 2)

P

Ploidy level (positive integer) either as a single value to specify the same ploidy for all simulated individuals, or as a vector of size N

M

Number of markers (positive integer superior or equal to 2)

C

Number of chromosomes (positive integer). By default, markers are evenly distributed between chromosomes and evenly spaced

L

Number of alleles (positive integer superior or equal to 2) either as a single value to specify the same number of alleles for all simulated markers, or as a vector of size M

SmoothParam

Smoothing parameter corresponding to the number of generations since admixture

GeneticMap

An optional genetic map that overrides the number of markers M and chromosomes C, with three named columns: Marker, Chromosome, Distance. The distances must be in centiMorgan

Prop

Preconfigured matrix of admixture proportions that overrides the number of individuals N and ancestral groups K

Freq

Preconfigured list of matrices of allele frequencies in ancestral groups that overrides the number of markers M, alleles L and ancestral groups K

AlphaProp

Concentration parameter from the Dirichlet distribution (positive numeric value) used for sampling admixture proportions

AlphaFreq

Concentration parameter from the Dirichlet distribution (positive numeric value) used for sampling allele frequencies in ancestral groups

Depth

(optional) Total read depth (positive integer), either as a single value to specify the same depth for all datapoints, or as a matrix of dimension N x M

SeqError

(optional) Sequencing error (numeric value between 0 and 1) rate to be used when sampling sequencing reads

NbThreads

Number of threads to be used (positive integer) with a default value of 0 setting automatically all threads available

Seed

Seed for reproducible inference (integer)

Value

A list of four items: a list of genotying matrices (Geno), a matrix of admixture proportions (Prop), a list of matrices of allele frequencies in ancestral groups (Freq), and a vector of log-likelihood values over iterations (LogLik)

Examples

## Simulate a polyploid admixed population
DataSim <- SimulatePop(K=3L, N=10L, P=6L, M=50L, C=5L, L=10L, Seed=123)

## Genotyping matrices
head(DataSim$Geno$Marker1)

## Ancestry matrices by chromosome
head(DataSim$Ancestry$Ind1$Chr1)

## Admixture proportions
head(DataSim$Prop)

## Allele frequencies in ancestral groups
DataSim$Freq$Marker1

## Genetic map
head(DataSim$GeneticMap)

AdmixPoly documentation built on June 18, 2026, 1:06 a.m.