plink_glm: Run 'plink2 –glm' and returns table of association...

View source: R/plink_glm.R

plink_glmR Documentation

Description

A wrapper for running plink2's genetic association test followed by reading of the results by read_plink_glm(). The --glm option is run with the modifiers omit-ref and hide-covar, which simplifies outputs.

Usage

plink_glm(
  name,
  name_phen = name,
  name_out = name,
  file_covar = NULL,
  vif = NA,
  max_corr = NA,
  plink_bin = "plink2",
  threads = 0,
  ver_older = FALSE,
  verbose = TRUE
)

Arguments

name

The shared name of the input plink BED/BIM/FAM files without extensions.

name_phen

The base name of the phenotype file without PHEN extension (default same as input name). Only the first phenotype (column 3) is used.

name_out

The base name of the output statistics file (default same as input name), which gets extension ".PHENO1.glm.linear" added automatically.

file_covar

Optional file path of fixed covariates for GLM. Pass the EIGENVEC file (with extension) to control for population structure using principal components.

vif

Maximum variance inflation factor (VIF). Plink applies a value of 50 by default to check for multicollinearity of the covariates, stopping with an error if any covariates have a VIF exceeding the maximum allowed. Here, NA leaves the default value; pass a non-NA value to alter maximum. Ignored unless file_covar is non-NULL.

max_corr

Maximum covariate correlation. Plink applies a value of 0.999 by default to check for multicollinearity of the covariates, stopping with an error if any covariates have a correlation exceeding the maximum allowed. Here, NA leaves the default value; pass a non-NA value to alter maximum. Ignored unless file_covar is non-NULL.

plink_bin

The path to the binary executable. Default assumes plink2 is in the PATH.

threads

The number of threads to use. The values 0 (default), NA, or NULL use all threads available (the output of parallel::detectCores()).

ver_older

Handles the case of missing covariates appropriately for older plink2 versions. In the newer versions we must include allow-no-covars option or plink2 fails; however in older versions we must not include allow-no-covars or plink2 fails!

verbose

If TRUE (default), prints the command line before it is executed, followed by the the path of the output file being read (after autocompleting the extensions).

Value

The table of genetic association statistics, as a tibble, read with read_plink_glm() (see that for more info).

See Also

read_plink_glm() for parsing the output of plink2 --glm.

delete_files_plink_glm(), delete_files_log() for deleting the output of plink2 --glm.

system3(), used (with ret = FALSE) for executing plink2 and error handling.

Examples

## Not run: 
data <- plink_glm( name, name_out = name_out )

## End(Not run)


OchoaLab/genbin documentation built on Nov. 14, 2024, 7:33 p.m.