GUSLD: Compute pairwise LD estimates using GUSLD

Description Usage Arguments Details Value Author(s) References Examples

View source: R/GUSLD.R

Description

Function computes the LD estimates for high-throughput sequencing data using the methodology by \insertCitebilton2018genetics2;textualGUSbase.

Usage

1
2
GUSLD(URobj, SNPpairs = NULL, indsubset = NULL, nClust = 2,
  LDmeasure = "r2", filename = NULL, dp = 4)

Arguments

URobj

An object of class UR created by the makeUR function.

SNPpairs

Matrix specifying the pairs of SNPs in which to calculate pairwise LD. See below for details.

indsubset

Vector of integer indices corresponding to individuals to be used in the LD calculations. Used to specify a subset of individuals of the data for which LD is calculated.

nClust

Integer number specifying the number of cores to use in the paralellization.

LDmeasure

Character vector specifying which LD measures to calculate. Predefined measures are Dcoef, Dprime and r2 (see details below). One can also specify their own LD measure (see examples).

filename

Character string giving the name of the file to write the LD results to. If NULL, the function returns the LD results instead of writing them to a file.

dp

Integer number specifying the number of decimal places to round the LD results. Note: only works when file is not NULL.

Details

Argument SNPpairs must be an integer matrix with two columns, where the first column specify the indices of the SNPs and the rows correspond to each SNP pair for which LD is to be computed. If SNPpairs=NULL, then LD is estimated for all the SNP paris in the dataset.

To reduce computation time, the calculations are performed in parallel using the foreach function. The nClust argument specifies the number of cores to use in the parallelization. Note: do not set this argument to more than the number of cores available (or bad things can happen!).

Value

A matrix object with named columns is returned where the columns are:

If filename=NULL then the matrix object is returned to the R workspace, otherwise if filename is specified and corresponds to a vaild name, then the matrix object is written to a file called filename_GUSMap.txt.

Author(s)

Timothy P. Bilton

References

\insertRef

bilton2018genetics2GUSbase

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Read in the deer data that accompanies the package
deerfile <- deerData()
rafile <- VCFtoRA(deerfile)
deer <- readRA(rafile)

## Create unrelated population
ur <- makeUR(deer)

###### LD estimation #######
## Estimate all the pairwise LD
LDres <- GUSLD(ur)
head(LDres)

## write results to file
GUSLD(ur, file="results")

## Specifying SNP pairs explicitly
# block vs block
pairs <- as.matrix(expand.grid(1:10,11:20))
LDres <- GUSLD(ur, SNPpairs=pairs)
head(LDres)

# Five SNPs before and after
temp <- rep(1:37,rep(5,37))
pairs <- cbind(temp, temp + 1:5)
pairs <- pairs[-which(pairs[,2] > 38),]
LDres <- GUSLD(ur, SNPpairs=pairs)
head(LDres)

##### Non-standard LD measure: #######
## Define LD measure as the correlation coefficient
LD_r <- function(pA1,pA2,D){
return( D/sqrt((prod(c(pA1,pA2,1-c(pA1,pA2))))) )
}
LDres <- GUSLD(ur, LDmeasure="LD_r")
head(LDres)

AgResearch/GUS-LD documentation built on July 31, 2019, 10:55 p.m.