rgenotypes {mmod}R Documentation

Randomly create genotypes

Description

Use the multinomial distribution to randomly create genotpes for individuals for given allele frequences. By default this function returns a matrix of with alleles in rows and individuals in columns. There is an option to return a genind object representing the same data (see examples).

Usage

rgenotypes(n, ploidy, probs, genind = FALSE, pop_name = "A",
  loc_name = "L1")

Arguments

n

integer number of indviduals.

ploidy

integer number of alleles to asign to each individual.

probs

vector of probabilies corresponding to allele frequences.

genind

boolean if TRUE return a genind object

pop_name

charcter Name for population defined in genind object (not required if genind is not TRUE)

loc_name

character name to five locus in genind object

Details

Used in chao_bootstrap, also exported as it may come in handy for other simulations.

Value

Either a matrix with individuals in columns, alleles in rows or, if genind is TRUE a genind object for one population and locus.

See Also

rmultinom which this function wraps.

Examples


data(nancycats)
obs_allele_freqs <- apply(nancycats$tab[,1:16], 2,mean, na.rm=TRUE)
rgenotypes(10, 2, obs_allele_freqs)

[Package mmod version 1.3.3 Index]