ligera2_bed_f: LIGERA2 BED: LIght GEnetic Robust Association main function

View source: R/ligera2_bed_f.R

ligera2_bed_fR Documentation

LIGERA2 BED: LIght GEnetic Robust Association main function

Description

This function performs the genetic association tests on every locus of a genotype matrix against a quantitative trait, implicitly computing the kinship matrix in a way that scales better than an explicit kinship estimate. The function returns a tibble containing association statistics and several intermediates. This version calculates p-values using an F-test, which gives calibrated statistics under both quantitative and binary traits. Compared to ligera2(), which uses the faster Wald test (calibrated for quantitative but not binary traits), this F-test version is quite a bit slower, and is optimized for m >> n, so it is a work in progress. This optimized version requires the genotypes to be in a file in BED format.

Usage

ligera2_bed_f(
  file,
  m_loci,
  n_ind,
  trait,
  mean_kinship,
  covar = NULL,
  mem_factor = 0.7,
  mem_lim = NA,
  m_chunk_max = 1000,
  V = 0,
  tol = 1e-15
)

Arguments

file

The path to the BED file containing the genotypes, potentially excluding the BED extension.

m_loci

The number of loci in the BED file.

n_ind

The number of individuals in the BED file.

trait

The length-n trait vector, which may be real valued and contain missing values.

mean_kinship

An estimate of the mean kinship produced externally, to ensure internal estimates of kinship are unbiased.

covar

An optional n-by-K matrix of K covariates, aligned with the individuals.

mem_factor

Proportion of available memory to use loading and processing genotypes. Ignored if mem_lim is not NA.

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 mem_factor times the free system memory, otherwise it is 1GB (OSX and other systems).

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.

V

Algorithm version (0, 1, 2). Experimental features, not worth explaining.

tol

Tolerance value passed to conjugate gradient method solver.

Details

Suppose there are n individuals and m loci.

Value

A tibble containing the following association statistics

  • pval: The p-value of the association test

  • beta: The estimated effect size coefficient for the trait vector at this locus

  • f_stat: The F statistic

  • df: degrees of freedom: number of non-missing individuals minus number of parameters of full model

See Also

The popkin package.

Examples

# MISSING SAMPLE BED FILE


OchoaLab/ligera documentation built on Jan. 5, 2023, 8:29 p.m.