LDit
Filed in: R
Simple R code to plot LD decay and
heatmap.
Assumes you have a data frame "x" which is the output from the rsq package from libsequence. These output look like:
sitei sitej rsq D Dprime
24 75 0.0123457 0.01 -1
24 186 1 0.09 1
24 246 0.0277778 0.02 -1
24 442 0.0123457 0.01 -1
Download example_file
NOTE: Please make sure you have version 0.7.7 of the analysis package. Older versions produce different output which will give you garbled and nonsensical results with this R code.
The code uses equation 1 from Remington (2001) to estimate C via nonlinear least squares and then plot the decay of LD with distance and a heatmap of r^2.
run the function as LDit(x,n) where x is your dataframe with headers and n the sample size. Requires the lattice library.
Download LDit.r
References
Remington DL, Thornsberry JM, Matsuoka Y, Wilson LM, Whitt SR et al. (2001) Structure of linkage disequilibrium and phenotypic associations in the maize genome. Proc Natl Acad Sci U S A 98: 11479-11484.