Calculate pairwise linkage disequilibrium and effective size using plink and shell script
Details: This program was made in order to make the Ne calculations using Plink outputs easier.
It consists in a collection functions which can use loaded in your terminal session using "source /path2file/calc_LD_Ne_plink.sh".
Alternatively, you could "copy and paste" the functions to your terminal session if you want before using them.
The structure is simple, composed by five steps to be followed in the exectution.
First of all, run all functions present in the section "FUNCTIONS", they will be needed.
After that follow the steps in the execution:
1. Make a binary file after quality control using Plink. Use your own code for that,
each data set has their own particularities, check literature to better understand.
2. Calcule the pairwise LD using Plink. Use the command provide here, change only the
specie if needed, the functions use the output of the provided command.
3. Check how many maker pairs are in different windows sizes. This important to know
how far you can go in the past based in the window size to estimate the Ne. A function
is provided here to check this. See Hayes et al. (2003) to better understand.
4. Check the windows size to achive a specified number of generations ago with a function
also provided here. The function is an arrangement of the formula in Hayes et al.
(2003) and can be used to obtaing an oposite answer of the item 3 (optional).
5. Calcule the Ne. A funtion to calculate the Ne based in Sved (1971) is provided here.
A correction based in the sample size presented in Corbin et al. (2012) was implemen-
ted. The generations ago for the Ne are based in the windows size (Hayes et al., 2003).