Returns the |L||R| value for each SNP location supplied to the function, where |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||R| diversity statistic, please see Jacobs (2016).

LR(pos, ws, X = NULL)

Arguments

pos

A numeric vector of SNP locations

ws

The window size which the LR 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 LR 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 LR for every SNP in the pos vector.

Value

A list containing the SNP positions and the LR 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

## load the snps example dataset data(snps) ## run LR over all the SNPs with a window size of 3000 bp LR(snps$bp_positions,3000)
#> $position #> [1] 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 #> [16] 1600 1700 1800 1900 2000 #> #> $LR #> [1] 0 15 30 45 60 70 78 84 88 90 90 88 84 78 70 60 45 30 15 0 #>
## only return results for SNPs between locations 600 and 1500 bp LR(snps$bp_positions,3000,X=c(600,1500))
#> $position #> [1] 600 700 800 900 1000 1100 1200 1300 1400 1500 #> #> $LR #> [1] 70 78 84 88 90 90 88 84 78 70 #>