writeLD: Linkage Disequilibrium (LD) computation with PLINK

Description Usage Arguments Value Note Examples

View source: R/writeLD.R

Description

writeLD write a '.ld' file for each chromosomes which contains the LD (r^2).

Usage

1
2
writeLD(pattern = "Chrom", snpInfoDir, signalFile, ldDir = NULL,
  ldThresh = 0.8, depth = 1000, mc.cores = 1)

Arguments

pattern

A character string containing a expression to be matched with all chromosomes files (e.g.,"Chrom" for files which start by "Chrom" followed by the chromosome number).

snpInfoDir

character: character string naming a directory containing the reference data in a PLINK format (.bed, .bim and .fam).

signalFile

The name of the signal file which the data are to be read from (2 columns: "SNP" and "PVALUE"). Each row of the table appears as one line of the file. If it does not contain an _absolute_ path, the file name is _relative_ to the current working directory, getwd. The fields separator character have to be a space " " or a tabulation "\t".

ldDir

character: character string naming a directory where the linkage disequilibrium files should be read (default NULL is in temporary directory). LD files can be the LD output from plink.

ldThresh

Threshold value for LD calculation.

depth

This parameter is mandatory and controls the maximum lag between SNPs considered.

mc.cores

numeric: the number of cores to use (default is 1), i.e., at most how many child processes will be run simultaneously. Must be at least one, and parallelization requires at least two cores.

Value

One ".ld" file per chromosome is returned by writeLD in snpInfoDir directory.

Note

The LD computation can take a long time depending on number of SNPs in signalFile. It is recommended to save LD results in a directory (ldDir) which is not a temporary directory.

Examples

1
2
3
4
5
if (interactive()) {
  signalFile <- system.file("extdata/Signal/toySignal.txt", package = "snpEnrichment")
  snpInfoDir <- system.file("extdata/snpInfo", package = "snpEnrichment")
  writeLD(pattern = "Chrom", snpInfoDir, signalFile, ldDir = NULL, ldThresh = 0.8, mc.cores = 1)
}

mcanouil/snpEnrichment documentation built on Sept. 19, 2021, 1:21 a.m.