simulate_admixture: Simulate genetic inheritance of SNPs based on population...

Description Usage Arguments Value Examples

View source: R/simulate_admixture.R

Description

Simulate genetic inheritance of SNPs based on population allele frequencies and family tree structure.

Usage

1
simulate_admixture(n_samples, ancestor_pop_label, file)

Arguments

n_samples

The number of samples to simulate.

ancestor_pop_label

A vector of integers giving the highest level of the family tree, which consists only of ancestors from pure genetic populations. Integers index the population, with order given by the order in which the population dominant allele frequencies are provided in the input allele frequencies file.

file

File with input allele frequencies of ancestor populations. This file must be in a specific format as exemplified in 'input-af-example.csv'. For a complete description of the format see read_in_af_data.

Value

A list of n_samples elements, each corresponding to a sample. Each element is a matrix with a row for each allele, and a column for each SNP. The elements of the matrix are characters for nucleotides (A,C,G,T).

Examples

1
2
3
4
5
6
7
8
#Download file to temporary directory:
temp_dir <- tempdir()
download.file(url = "https://raw.githubusercontent.com/danwkenn/SimAdmixtR/master/inst/example-files/input-allele-frequencies-three-snps.csv",destfile = paste0(temp_dir,"/input-af-example.csv"))
sim_data <- simulate_admixture(
n_samples = 10,
ancestor_pop_label = c(1,2,2,2),
file = paste0(temp_dir,"/input-af-example.csv")
)

danwkenn/SimAdmixtR documentation built on May 30, 2020, 7:25 a.m.