L_plus_R: Runs the L_plus_R function

Description Usage Arguments Value References Examples

View source: R/L_plus_R.R

Description

Returns the (|L| choose 2) + (|R| choose 2) value for each SNP location supplied to the function. |L| and |R| are the number of SNPs to the left and right of the current locus within the given window ws. For more information about the L_plus_R diversity statistic, please see Jacobs (2016).

Usage

1
L_plus_R(pos, ws, X = NULL)

Arguments

pos

A numeric vector of SNP locations

ws

The window size which the L_plus_R statistic will be calculated over. This should be on the same scale as the pos vector.

X

Optional. Specify a region of the chromosome to calculate L_plus_R for in the format c(startposition, endposition). The start position and the end position should be within the extremes of the positions given in the pos vector. If not supplied, the function will calculate L_plus_R for every SNP in the pos vector.

Value

A list containing the SNP positions and the L_plus_R values for those SNPs

References

Jacobs, G.S., T.J. Sluckin, and T. Kivisild, Refining the Use of Linkage Disequilibrium as a Robust Signature of Selective Sweeps. Genetics, 2016. 203(4): p. 1807

Examples

1
2
3
4
5
6
## load the snps example dataset
data(snps)
## run L_plus_R over all the SNPs with a window size of 3000 bp
L_plus_R(snps$bp_positions,3000)
## only return results for SNPs between locations 600 and 1500 bp
L_plus_R(snps$bp_positions,3000,X=c(600,1500))

zalpha documentation built on Nov. 27, 2021, 9:06 a.m.