Learn R Programming

diveRsity (version 1.9.89)

inCalc: A function to calculate locus informative for the inference of ancestry

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

inCalc(infile = NULL, outfile = NULL, pairwise = FALSE, xlsx = FALSE, boots = NULL, para = 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. See http://genepop.curtin.edu.au/help_input.html for detail on the genepop file format.
outfile
Allows users to specify a prefix for an output folder. Name must a character string enclosed in either ``'' or `'.
pairwise
Specified whether pairwise I\_n should be calculated.
xlsx
A logical argument indicating whether results should be written to an xlsx file. If xlsx = FALSE (default), results will be written to text files.
boots
Determines the number of bootstrap iterations to be carried out. The default value is boots = 0, this is only valid when all bootstrap options are false.
para
Allows for parallel computation of pairwise locus In. The number of available core is automatically detected if para = TRUE.

Value

inCalc return a list object to the R workspace, with elements described below. In addition to this results can be optionally written to file using the outfile argument. If xlsx = TRUE results will be written to a multi-sheet xlsx file. If xlsx = FALSE results are written to multiple text file, the number of which depends on the function arguments used.

Details

All results will be written to a user defined folder ("working\_directory/outfile"). The format of outputs will vary depending value of the xlsx argument. If xlsx = TRUE, results will be written to a .xlsx workbook using the xlsx package. If xlsx = FALSE, results will be written to .txt files.

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

Run this code
## Not run: 
# # To run an example use the following format
# library(diveRsity)
# data(Test_data)
# Test_data[is.na(Test_data)] <- ""
# 
# test_results<-inCalc(infile = Test_data, outfile = 'out', pairwise = TRUE,
#                      xlsx = FALSE, boots = 1000, para = TRUE)
# ## End(Not run)

Run the code above in your browser using DataLab