ld_matrix_1000g_plink: Retrieve LD matrix with plink 1.9 and a local genotype file

View source: R/bio_LD_matrix.R

ld_matrix_1000g_plinkR Documentation

Retrieve LD matrix with plink 1.9 and a local genotype file

Description

This function is a wrapper around a system call to plink 1.9 to generate LD statistics for a list of SNPs. It requires a set of .bed/.bim/.bam files as input, which can be provided in the same format as plink's –bfile parameter. Alternatively, you can provide a .tar (possibly compressed) file containing the .bed/.bim/.bam files, and this function will unpack it on-the-fly.

Usage

ld_matrix_1000g_plink(
  snps,
  genofile,
  mode = c("r", "r2"),
  plink = Sys.which("plink"),
  pop = "EUR",
  maf = 0.01,
  hwe = 1e-05,
  geno = 0.1,
  ld_window_kb = 10000,
  ld_window = 1e+05,
  num_threads = parallel::detectCores(),
  sys.path = NULL,
  ...
)

Arguments

snps

List of variants

genofile

Location of the local plink file containing 1000G data. This can be one of the the .bed/.bim/.bam files, and the remaining filenames are assumed to have the same basename as the provided file. You can also provide a file basename in the same format as plink's –bfile parameter. Alternatively, a tar file (possibly compressed) containing the .bed/.bim/.bam files can be provided, and it will be temporarily unpacked/decompressed. NOTE: the .bam files are assume to list alleles in ALT/REF order. plink then assigns ALT to A1 and REF to A2 in plink, using the --keep-allele-order parameter.

mode

"r" or "r2". Whether to calculate r or r2.

plink

Path to plink v1.9 executabl.

pop

A 1000 Genomes Project population, default = "EUR"

maf

MAF cutoff for plink filtering.

hwe

HWE cutoff for plink filtering.

geno

geno cutoff plink filtering.

ld_window_kb

From PLINK: By default, when a limited window report is requested, every pair of variants with at least (10-1) variants between them, or more than 1000 kilobases apart, is ignored. You can change the first threshold with –ld-window, and the second threshold with –ld-window-kb.

ld_window

From PLINK: By default, when a limited window report is requested, every pair of variants with at least (10-1) variants between them, or more than 1000 kilobases apart, is ignored. You can change the first threshold with –ld-window, and the second threshold with –ld-window-kb.

num_threads

Number of threads for plink

sys.path

Optional path variable to (temporarily) append to R's PATH environment variable. Useful for automatically finding executables, such as plink, tar decompressors, etc.

...

Additional options to be sent to plink


adamleejohnson/R-ajtools documentation built on April 4, 2022, 7:24 a.m.