inCalc: A function to calculate locus informative for the inference...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/diveRsity-code.R

Description

inCalc allows the calculation of locus informativeness for ancestry (In), (Rosenberg et al., 2003), both across all population samples under consideration and for all pairwise combinations of population samples. These data can be bootstrapped using the same procedure as above, to obtain 95% confidence intervals.

Usage

1
2
3
inCalc(infile, outfile = NULL, gp = 3, 
       bs_locus = FALSE, bs_pairwise = FALSE, 
       bootstraps = 0, plot = FALSE, parallel = FALSE)

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.

bs_locus

Gives users the option to bootstrap locus statistics. Results will be written to .xlsx file by default if the package 'xlsx' is installed, and to a .png file if plot=TRUE. If 'xlsx' is not installed, results will be written to .txt files.

bs_pairwise

Gives users the option to bootstrap statistics across all loci for each pairwise population comparison. Results will be written to a .xlsx file by default if the package 'xlsx' is installed. If 'xlsx' is not installed, results will be written to .txt files.

bootstraps

Determines the number of bootstrap iterations to be carried out. The default value is bootstraps = 0, this is only valid when all bootstrap options are false. Again, there is no limit on the number of bootstrap iterations, however very large numbers of bootstrap iterations (i.e. > 1000) will take quite a long time to run.

plot

Optional .png image file of the plotted bootstrap results for loci if bs_locus = TRUE. The default option is plot = FALSE.

parallel

Allows for parallel computation of pairwise locus In. The number of available core is automatically detected if parallel = TRUE.

Details

All results will be written to a user defined folder ("working_directory/outfile"). The format of outputs will vary depending on the availability of the package 'xlsx' in the users local package library. If 'xlsx' is available, results will be written to an Excel workbook. If 'xlsx' is not available, results will be written to .txt files.

Value

Allele_In

A character matrix of allelic In values per locus along with locus sums.

l_bootstrap

A character matrix of locus In values as well as 95% confidence intervals, calculated from bootstraps (Manly, 1997). Returned when bs_locus is set to TRUE.

PW_bootstrap

A list of matrices of bootstrapped pairwise locus In results corresponding to each pairwise comparison.

Author(s)

Kevin Keenan <kkeenan02@qub.ac.uk>

References

Dragulescu, A.D., “xlsx: Read, write, formal Excel 2007 and Excel 97/2000/xp/2003 files”, R package version 0.4.2, url:http://CRAN.R-project.org/package=xlsx, (2012).

Manly, F.J., “Randomization, bootstrap and Monte Carlo methods in biology”, Chapman and Hall, London, 1997.

Rosenberg, N., Li, L., Ward, R., and Pritchard, J., “Informativeness of genetic markers for inference of ancestry.,” American Journal of Human Genetics, vol. 73, no. 6, pp. 1402-22, (2003).

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
# To run an example use the following format
#
# test_results<-inCalc(infile = Test_data, outfile = 'out',
#                      gp = 3, bs_locus = TRUE, bs_pairwise = TRUE,
#                      bootstraps = 10, plot = FALSE, parallel = TRUE)

kkeenan02/diveRsity-dev documentation built on May 20, 2019, 10:46 a.m.