| gl.TajimasD | R Documentation |
This function calculate Tajima's D, with p-values from beta distribution, standard normal distribution and simulation from ms (Hudson, 2002) for each population in the dartR/genlight object.
#' simulation results can only be output if ms and sample_stats are available. Both programs need to be compiled from here: https://home.uchicago.edu/rhudson1/source/mksamples.html or binaries can be downloaded via: gl.download.binary. If you provide the ms path, the function will simulate a population according to the provided dartR/genlight object. The function will then calculate Tajima's D for each population and compare the results from ms and plot the distribution of simulated Tajima's D for each population. (this can be used to test the TajimasD against a neutral model of evolution [p values is provided under sim_pval]).
Refer to the ms manual for further information on the program and simulation. Here we estimate theta from the number of segregating sites (S) and the number of alleles (k) in the sample and simulate a population according to the provided dartR/genlight object.
gl.TajimasD(
x,
ms.path = NULL,
simulation.out = NULL,
rep = NULL,
seeds = NULL,
cleanup = TRUE,
plot.dir = NULL,
plot.out = TRUE,
plot.file = NULL,
plot_theme = NULL,
verbose = 2
)
x |
Name of the genlight object containing the SNP data [required] |
ms.path |
absolute path that stores the ms program (eg: /User/msdir/) [default NULL]. |
simulation.out |
Directory in which to save simulated summary statistics from MS, given ms.path is provided [default NULL]. |
rep |
Number of replicates in ms [default NULL, required for simulation]. |
seeds |
Seeds for the random number generator in ms [default NULL, seeds are randomly generated]. |
cleanup |
clean data in tmp [default TRUE]. |
plot.dir |
Directory in which to save files [default working directory]. |
plot.out |
Specify if plot is to be produced [default TRUE]. |
plot.file |
Name for the RDS binary file to save (base name only, exclude extension) [default NULL]. |
plot_theme |
Theme of the plot [default theme_dartR()]. |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity]. |
A plot and table of Tajima's D for each population ( and results from MS and plots of simulated Tajima's D can be returned if ms.path is provided). If you use ms, please make sure you cite: Hudson, R. R. (2002). Generating samples under a Wright–Fisher neutral model of genetic variation. Bioinformatics, 18(2), 337-338.
A plot and table of Tajima's D (results from MS and plot of simulated Tajima's D can be returned if ms.path is provided)
Renee Catullo (Custodian: Ching Ching Lau) – Post to https://groups.google.com/d/forum/dartr
Tajima, F. (1989). Statistical method for testing the neutral mutation hypothesis by DNA polymorphism. Genetics, 123(3), 585-595.
Hudson, R. R. (2002). Generating samples under a Wright–Fisher neutral model of genetic variation. Bioinformatics, 18(2), 337-338.
Paradis, E. (2010). pegas: an R package for population genetics with an integrated–modular approach. Bioinformatics, 26(3), 419-420.
# To run without ms simulation
Tajima <- gl.TajimasD(x=bandicoot.gl)
#' # To run with ms simulation
## Not run:
Tajima <- gl.TajimasD(x=bandicoot.gl, rep=10, ms.path="/User/msdir/")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.