simulGenosDoseStruct: Genotypes

View source: R/quantgen.R

simulGenosDoseStructR Documentation

Genotypes

Description

Simulate SNP genotypes as allele dose additively encoded, i.e. 0,1,2, using correlated allele frequencies to mimick genetic structure.

Usage

simulGenosDoseStruct(
  nb.genos = c(100, 120, 80),
  nb.snps = 1000,
  div.pops = diag(3) * 0.5 + 0.5,
  geno.ids = NULL,
  snp.ids = NULL
)

Arguments

nb.genos

number of genotypes (i.e. individuals) per population

nb.snps

number of SNPs

div.pops

matrix of divergence among populations, with a diagonal of 1's; the closer off-diagonal values are from 1; the weaker the divergence; the further, the stronger

geno.ids

vector of genotype identifiers (if NULL, will be "geno001", etc)

snp.ids

vector of SNP identifiers (if NULL, will be "snp001", etc)

Value

matrix with genotypes in rows and SNPs in columns

Author(s)

Andres Legarra [aut], Timothee Flutre [ctb]

Examples

## Not run: 
## weak divergences among populations:
weak.div.pops <- diag(3)
weak.div.pops[upper.tri(weak.div.pops)] <- 0.9
weak.div.pops[lower.tri(weak.div.pops)] <- weak.div.pops[upper.tri(weak.div.pops)]
weak.div.pops

## strong divergences among populations:
strong.div.pops <- diag(3)
strong.div.pops[upper.tri(strong.div.pops)] <- 0.5
strong.div.pops[lower.tri(strong.div.pops)] <- strong.div.pops[upper.tri(strong.div.pops)]
strong.div.pops

X <- simulGenosDoseStruct(div.pops=weak.div.pops)
A <- estimGenRel(X)
imageWithScale(A, "Weak divergence")

X <- simulGenosDoseStruct(div.pops=strong.div.pops)
A <- estimGenRel(X)
imageWithScale(A, "Strong divergence")

## End(Not run)

timflutre/rutilstimflutre documentation built on Feb. 12, 2025, 11:35 p.m.