divBasic: A function to calculate basic population parameters such as...

Description Usage Arguments Details Value Author(s) References Examples

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

1
2
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.

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.

Value

locus_pop_size

A matrix containing the number of individuals typed per locus per population sample. Mean values across loci are also given.

Allele_number

A matrix containing the number of alleles observed per locus per population sample. Mean values across loci are also given.

proportion_Alleles

A matrix containing the percentage of total alleles observed per locus per population sample. Mean values across loci are also given.

Allelic_richness

A matrix containing the allelic richness per locus per population sample. Allelic richness is calculated using 1000 re-samples (n = smallest sample in the input data file), with replacement per population sample locus per population sample. Mean values across loci are also given.

Ho

A matrix containing observed heterozygosity per locus per population sample. Mean values across loci are also given.

He

A matrix containing expected heterozygosity per locus per population sample. Mean values across loci are also given.

HWE

A matrix containing uncorrected p-values from chi-square test for goodness-of-fit to Hardy-Weinberg equilibrium. Overall p-values are also given per population sample.

fis

A list of dataframes containing locus and global F_is values for each population sample. In each dataframe the actual F_is is listed in the first column of the matrix, lower and upper 95% confidence intervals are listed in the next two columns, while bias corrected 95% CI are listed in the last two columns. This object is only returned when bootstraps is not NULL

Author(s)

Kevin Keenan <kkeenan02@qub.ac.uk>

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

1
2
3
4
5
6
## 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)

diveRsity documentation built on May 1, 2019, 10:30 p.m.