Learn R Programming

diveRsity (version 1.9.89)

divBasic: A function to calculate basic population parameters such as allelic richness, observed heterozygosity, as well as expected heterozygosity.

Description

divBasic allows the calculation of locus and overall basic population parameters. divBasic will write results to a .xlsx workbook. The function accepts co-dominant genetic data in both 2 and 3 digit genepop formats.

Usage

divBasic(infile = NULL, outfile = NULL, gp = 3, bootstraps = NULL, HWEexact = FALSE, mcRep = 2000)

Arguments

infile
Specifying the name of the `genepop'(Rousset, 2008) file from which the statistics are to be calculated. This file can be in either the 3 digit of 2 digit format, and must contain only one whitespace separator (e.g. “space” or “tab”) between each column including the individual names column. The number of columns must be equal to the number of loci + 1 (the individual names column). If this file is not in the working directory the file path must be given. The name must be a character string (i.e. enclosed in “” or `').
outfile
Allows users to specify a prefix for an output folder. Name must a character string enclosed in either ``'' or `'.
gp
Specifies the digit format of the infile. Either 3 (default) or 2.
bootstraps
This argument specifies how many bootstrap iterations should be executed when calculating 95% confidence intervals for $F_is$. The argument should be an integer greater than 1. Setting bootstrap = NULL suppresses the calculation of F_is. Users should note that setting this argument to values greater than 1000 may result in longer executions times.
HWEexact
A logical argument specifying if HWE testing should be carried out using Fisher's exact tests.
mcRep
An integer specifying the number of replicates to use for the Monte Carlo tests if HWEexact is TRUE.

Value

Details

All results will be written to a user defined folder ("working_directory/outfile"), providing an argument is passed for 'outfile'. Results will be written to .xlsx files, and multiple R objects are also written to the current environment.

HWE tests can be carried out using either a standard Chisq goodness of fit method, or using Fisher's exact method. The standard chisq test behave poorly when there are classes with low numbers of observations (e.g. hypervariable microsatellite loci). In such instance it is advisable to use exact testing. Multi-locus HWE is tested using the standard chisq method by summing chisq difference and degrees of freedom across loci, and using these parameter to derive a pvalue for the test. When using exact testing, the multi-locus pvalue is determined using Fisher's method for combining pvalue from independent tests. This process assumes that loci are unlinked.

References

Rousset, F., ``genepop'007: a complete re-implementation of the genepop software for Windows and Linux.,'' Molecular ecology resources, vol. 8, no. 1, pp. 103-6, (2008).

Examples

Run this code
## Not run: 
# # To run an example use the following format
# 
# test_results <- divBasic(infile = Test_data, outfile = 'out', gp = 3, bootstraps = 1000)
# ## End(Not run)

Run the code above in your browser using DataLab