Skip to contents

This function computes linkage disequilibrium (LD) statistics for SNP data using PLINK. It allows for computation across all SNPs or within specific chromosomes.

Usage

ComputeLD(DataDir, ResultDir, finput, ByCHR = FALSE, CHRnum = NULL, r2_LD)

Arguments

DataDir

Character string representing the file path 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.

finput

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

ByCHR

Logical indicating whether to perform the computation by chromosome. The default is FALSE.

CHRnum

If ByCHR is TRUE, specifies the chromosome number for which LD should be computed. The default is NULL.

r2_LD

The threshold for r-squared LD values to report in the output.

Value

Returns a data frame containing the computed LD values among SNPs, read from the output file generated by PLINK.

Examples

snpld <- ComputeLD(
    DataDir = GXwasR:::GXwasR_data(), ResultDir = tempdir(),
    finput = "GXwasR_example", ByCHR = TRUE, CHRnum = 1, r2_LD = 0.2
)