Skip to contents

This function utilizes PLINK to perform LD pruning on genetic data. It identifies and removes SNPs that are in high linkage disequilibrium with each other within specified windows.

Usage

LDPrune(
  DataDir,
  finput,
  ResultDir = tempdir(),
  window_size = 50,
  step_size = 5,
  r2_threshold = 0.2
)

Arguments

DataDir

Character string representing the file path of the input PLINK binary files.

finput

Character string specifying the prefix of the input PLINK binary files.

ResultDir

Character string for the file path where all output files will be stored, defaulting to a temporary directory.

window_size

Integer, specifying the number of SNPs to include in the sliding window.

step_size

Integer, specifying the number of SNPs the window moves over in each step.

r2_threshold

Numeric, specifying the R^2 threshold for LD pruning.

Value

Returns a character vector of SNP identifiers that remain after LD pruning or NULL if an error occurs.

Examples

DataDir <- GXwasR:::GXwasR_data()
ResultDir <- tempdir()
finput <- "GXwasR_example"
prunedSNPs <- LDPrune(DataDir, finput, ResultDir, 50, 5, 0.2)