popkin_af | R Documentation |
Given the individual-specific allele frequencies of n
individuals, this function returns the n
-by-n
coancestry matrix.
This function is the analog of popkin()
for allele frequencies rather than genotypes, and as a consequence estimates coancestry instead of kinship.
These coancestry estimates are unbiased if the true allele frequencies are provided, but may be less accurate when the allele frequencies themselves are estimated.
This function is intended for cases where allele frequencies, but not individual genotypes, are available; otherwise it is best to use the individual genotypes and popkin()
.
An application of interest is the allele frequency matrices from admixture models, in which case the columns correspond to subpopulations rather than individuals, and subpops = NULL
is an acceptable choice.
popkin_af( P, subpops = NULL, loci_on_cols = FALSE, mem_factor = 0.7, mem_lim = NA, want_M = FALSE, m_chunk_max = 1000 )
P |
|
subpops |
The length- |
loci_on_cols |
If |
mem_factor |
Proportion of available memory to use loading and processing data.
Ignored if |
mem_lim |
Memory limit in GB, used to break up data into chunks for very large datasets.
Note memory usage is somewhat underestimated and is not controlled strictly.
Default in Linux is |
want_M |
If |
m_chunk_max |
Sets the maximum number of loci to process at the time. Actual number of loci loaded may be lower if memory is limiting. |
If want_M = FALSE
, returns the estimated n
-by-n
coancestry matrix only.
If P
has names for the individuals, they will be copied to the rows and columns of this coancestry matrix.
If want_M = TRUE
, a named list is returned, containing:
coancestry
: the estimated n
-by-n
coancestry matrix
M
: the n
-by-n
matrix of non-missing pair counts (see want_M
option).
popkin()
for kinship estimation from genotype matrices.
# a matrix of random uniform allele frequencies # (unstructured, unlike real data) P <- matrix( runif( 9 ), nrow = 3 ) coancestry <- popkin_af( P )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.