View source: R/genepop_to_genind.R
genepop_to_genind | R Documentation |
The function converts a text file in the format used by GENEPOP software into a genind object
genepop_to_genind(path, n.loci, pop_names = NULL, allele.digit.coding = 3)
path |
A character string with the path leading to the GENEPOP file in format .txt, or alternatively the name of this file in the working directory. |
n.loci |
The number of loci in the GENEPOP file (integer or numeric). |
pop_names |
(optional) Populations' names in the same order as in the GENEPOP file. Vector object (class character) of the same length as the number of populations. Without this parameter, populations are numbered from 1 to the number of populations. |
allele.digit.coding |
Number indicating whether alleles are coded with 3 (default) or 2 digits. |
This function uses functions from pegas package. GENEPOP file should can include microsatellites loci or SNPs with allele names of length 2 or 3 (noted as 01, 02, 03 or 04 for SNPs). The loci line(s) must not start with a spacing.
An object of type genind
.
P. Savary
raymond1995genepopgraph4lg
For more details about GENEPOP file formatting :
https://genepop.curtin.edu.au:443/help_input.html
For the opposite conversion, see genind_to_genepop
.
The output file can be used to compute pairwise FST matrix
with mat_pw_fst
path_in <- system.file('extdata', 'gpop_simul_10_g100_04_20.txt', package = 'graph4lg') file_n <- file.path(tempdir(), "gpop_simul_10_g100_04_20.txt") file.copy(path_in, file_n, overwrite = TRUE) genepop_to_genind(path = file_n, n.loci = 20, pop_names = as.character(order(as.character(1:10)))) file.remove(file_n)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.