Description Usage Arguments Details Value Examples
View source: R/read_in_af_data.R
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.
1 | read_in_af_data(file, ancestor_pop_label = NULL)
|
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. |
The CSV file must comply with the following format rules:
Each row corresponds to a SNP.
The file's first 3 columns must be the SNP ID, The chromosome and position, and the SNP variants.
The variants must be specified by a list of nucleotides separated by backslashes '/', where the most frequent allele is first. E.g. 'A/G' specifies a SNP with the most common variant being 'A' and the least common being 'G'.
In the following columns the derived allele frequencies in each pure population. The column names must have "(D)" at the end of their name to be recognised.
Only ancestor population allele frequencies can have names ending with (D).
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.
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.