Compute popkin's A and M matrices from genotypes
This function returns lower-level, intermediate calculations for the main popkin
function.
These are not intended for most users, but rather for researchers studying the estimator.
popkin_A( X, n = NA, loci_on_cols = FALSE, mem_factor = 0.7, mem_lim = NA, m_chunk_max = 1000 )
X |
Genotype matrix, BEDMatrix object, or a function |
n |
Number of individuals (required only when |
loci_on_cols |
If |
mem_factor |
Proportion of available memory to use loading and processing genotypes.
Ignored if |
mem_lim |
Memory limit in GB, used to break up genotype data into chunks for very large datasets.
Note memory usage is somewhat underestimated and is not controlled strictly.
Default in Linux and Windows is |
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. |
A named list containing:
A
: n-by-n matrix, for individuals j
and k
, of average ( x_ij - 1 ) * ( x_ik - 1 ) - 1
values across all loci i
in X
M
: n-by-n matrix of sample sizes (number of loci with non-missing individual j
and k
pairs, used to normalize A
)
The main popkin()
function (a wrapper of this popkin_A
function and popkin_A_min_subpops()
to estimate the minimum A
value).
# Construct toy data X <- matrix(c(0,1,2,1,0,1,1,0,2), nrow = 3, byrow = TRUE) # genotype matrix # NOTE: for BED-formatted input, use BEDMatrix! # "file" is path to BED file (excluding .bed extension) # library(BEDMatrix) # X <- BEDMatrix(file) # load genotype matrix object obj <- popkin_A(X) # calculate A and M from genotypes A <- obj$A M <- obj$M
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.