View source: R/calc_AF_vectors.R
calc_AF_vectors | R Documentation |
Takes as input a population map (popmap) and a VCF (vcfR object) and returns an m x n matrix, where m = the number of SNPs and n = the number of populations
calc_AF_vectors( vcf = NULL, window_size = 200, popmap = NULL, vectors = NULL, n_cores = 1, normalise = TRUE, end_cutoff = window_size, null_perms = NULL, data_type = "vcf" )
vcf |
A vcf stored as a vcfR object |
window_size |
Integer value describing how many SNPs to include per window |
popmap |
A two column data.frame, column 1 lists individuals and column 2 population assignment |
vectors |
A list object that descibes each vector. Each list element should be a character vector with two strings, each corresponding to a population in the popmap |
n_cores |
number of cores to run with mclapply. If n_cores=1, runs with lapply instead. |
normalise |
Boolean to determine whether allele frequencies should be normalised. Normalisation is essential for vector analysis, but setting normalise=FALSE permits comparison with the raw allele frequencies |
end_cutoff |
Numeric value describing how many SNPs the last window can have. By default, this equals the window_size, such that the last window must have the same number of SNPs as all windows. This is highly recommended. |
null_perms |
Integer value describing how many null permutations to run. When set to NULL, function returns observed allele frequency vectors. When set to any integer value, the function returns randomised permutated vectors that are used for estimation of the null distribution. |
data_type |
Character string indicating whether data is in vcfR form 'vcf' - default. Or as a matrix of allele frequencies 'freq'. Data in the form of a frequency matrix must have chromosome and position info in cols 1 and 2 respectively. Remaining colnames must match the population IDs listed in the vector list. |
A list object where each element corresponds to an m (number of SNPs per window) x n (number of populations) matrix of allele frequency change vectors
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.