af: Allele frequencies

View source: R/af.R

afR Documentation

Allele frequencies

Description

Compute matrix of individual-specific allele frequencies

Usage

af(X, LF, safety = FALSE, max_iter = 100, tol = 1e-10)

Arguments

X

A matrix of SNP genotypes, i.e. an integer matrix of 0's, 1's, 2's and NAs. BEDMatrix is supported. Sparse matrices of class Matrix are not supported (yet).

LF

Matrix of logistic factors, with intercept. Pass in the return value from lfa()!

safety

Optional boolean to bypass checks on the genotype matrices, which require a non-trivial amount of computation. Ignored if X is a BEDMatrix object.

max_iter

Maximum number of iterations for logistic regression

tol

Numerical tolerance for convergence of logistic regression

Details

Computes the matrix of individual-specific allele frequencies, which has the same dimensions of the genotype matrix. Be warned that this function could use a ton of memory, as the return value is all doubles. It could be wise to pass only a selection of the SNPs in your genotype matrix to get an idea for memory usage. Use gc() to check memory usage!

Value

Matrix of individual-specific allele frequencies.

Examples

LF <- lfa( hgdp_subset, 4 )
allele_freqs <- af( hgdp_subset, LF )

StoreyLab/lfa documentation built on March 7, 2024, 9:59 p.m.