read_in_af_data: Read in the population allele frequencies from prespecified...

Description Usage Arguments Details Value Examples

View source: R/read_in_af_data.R

Description

This function is used internally to read in allele frequency information and complete basic cleaning. To ensure that the correct probabilities are used in simulation, care should be taken to ensure the input file complies with the required format (see Details below), and that the order of the populations given in the input file is kept consistent with the input ancestor_pop_label in the simulation functions.

Usage

1
read_in_af_data(file, ancestor_pop_label = NULL)

Arguments

file

Path to CSV file containing the population allele frequencies.

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. In this function this parameter is only used to check that it corresponds correctly to the input file. Leaving it at its default value ('NULL') will bypass these checks and load the input file.

Details

The CSV file must comply with the following format rules:

Value

A tibble data-frame with a column for the SNP ID called snp_id, a column for the variants called variants which contain character vectors for each SNP, and a column for each population of allele frequencies as sum-to-one constrained vectors.

Examples

1
2
3
4
5
#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"))
allele_frequencies.tbl <- read_in_af_data(file = paste0(temp_dir,"/input-af-example.csv"))
allele_frequencies.tbl

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