# getLD: Computation of LD Measures In trio: Testing of SNPs and SNP Interactions in Case-Parent Trio Studies

## Description

While `getLD` computes the value of D' and r^2 for each pair of SNPs in a matrix, `getLDlarge` determines D' and r^2 between each SNP and a user-specified number of SNPs closest to the SNP on the corresponding chromosome. Thus, `getLDlarge` can be applied to much more SNPs than `getLD`.

## Usage

 ```1 2 3 4 5``` ``` getLD(x, which = c("both", "rSquare", "Dprime"), parentsOnly = FALSE, iter = 50, snp.in.col = TRUE, asMatrix = FALSE, addVarN = FALSE) getLDlarge(x, neighbors=25, which=c("both", "rSquare", "Dprime"), parentsOnly=FALSE, iter=50, snp.in.col=TRUE, addVarN=FALSE) ```

## Arguments

 `x` a numeric matrix consisting of 0, 1, and 2, where it is assumed that the values represent the numbers of minor alleles that the SNPs show. Missing values are allowed. By default, each column represents a SNP and each row a subject. This can be changed by setting `snp.in.col = FALSE`. It is assumed that the SNPs are ordered by their position on the considered chromosome. `neighbors` positive integer specifying the number of neighbors of a SNP (in both directions) on a chromosome for which D' or r^2 should be computed. Thus, for each SNP (except for the SNPs in the first and last `neighbors` columns of `x`), 2 * `neighbors` r^2 or D' values are computed. `which` which LD measures should be computed? Either `"rSquare"`, or `"Dprime"`, or the values of `"both"` measures are computed. The latter is the default. `parentsOnly` logical indicating whether only the genotypes of the parents, i.e.\ rows 1, 2, 4, 5, ... of `x`, should be used in the computation of the LD measures when `x` is in genotype format and contains case-parent trio data (see `ped2geno` and `read.pedfile`). If `FALSE` (default), all rows are used in the determination of the pairwise LD measure. `iter` integer specifying how many iterations are used in the procedure of Hill (1974) which is used to estimate D. `snp.in.col` logical indicating whether each column of `x` represents a SNP (and each row a subject). If `FALSE`, each row represents a SNP (and each column a subject). `asMatrix` logical indicating whether the LD values are returned as a m x m matrix, where m is the number of SNPs. If `FALSE`, the LD values are returned as a vector of length m * (m - 1) / 2. `addVarN` logical indicating whether for each pair of SNPs the number of non-missing values and the variance estimates of D' proposed by Zabaleta et al. (1997) should be added to the output. The variance estimates are required for the identification of LD-blocks with `findLDblocks`.

## Value

An object of class `getLD` or `getLDlarge` consisting (depending of the specification of `which`) the D' (`Dprime`) or r^2 (`rSquare`) values for each SNP pair, and (depending of the specification of `addVarN`) the variance estimates for D' (`varDprime`) and the numbers of non-missing values (`n`). Furthermore, the names of the SNPs (`rn`) will be added (in `getLD`, if `asMatrix = FALSE`).

## Author(s)

Holger Schwender, holger.schwender@udo.edu

## References

Hill, W.O. (1974). Estimation of Linkage Disequilibrium in Randomly Mating Populations. Heredity, 33, 229-239.

Zapata, C., Alvarez, G., and Carollo, C. (1997). Approximate Variance of the Standardized Measure of Gametic Disequilibrium D'. American Journal of Human Genetics, 61, 771-774.

`plot.getLD`, `findLDblocks`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```# Load the simulated data. data(trio.data) # The values of Dprime and Rsquare for each pair of SNPs # in LDdata can be computed by ld.out <- getLD(LDdata) # By default, the LD measures are returned as a vector. # If they should be returned as a matrix, then use ld.out2 <- getLD(LDdata, asMatrix = TRUE) ```

### Example output

```
```

trio documentation built on Nov. 8, 2020, 7:41 p.m.