The function converts an object of class genind
into
a GENEPOP file.
It then allows to use the functionalities of the GENEPOP software and
its derived package GENEPOP on R, as well as some functions
from other packages (differentiation test, F-stats calculations,
HWE test,...).
It is designed to be used with diploid microsatellite data with
alleles coded with 2 or 3 digits or SNPs genind objects.
genind_to_genepop(x, output = "data.frame")
An object of type data.frame
if ouput = "data.frame"
.
If output
is the path and/or the file name of a text file, then
nothing is returned in R environment but a text file is created with the
specified file name, either in the current working directory or in the
specified folder.
An object of class genind
from package adegenet.
A character string indicating the option used to select what the function will return:
If output = "data.frame"
(default), then the function will
return an object 'x' of class data.frame
ready to be saved as a
text file with the following command:
write.table(x, file = "file_name.txt", quote=FALSE,
row.names=FALSE, col.names=FALSE)
If output = "path_to_file/file_name.txt"
, then the function
will write a text file named 'file_name.txt' in the directory corresponding
to 'path_to_file'. Without 'path_to_file', the text file is written in the
current working directory. The text file has the format required by GENEPOP
software.
Do not confound this function with genind2genpop
from adegenet. The latter converts an object of class genind
into an object of class genpop
, whereas genind_to_genepop
converts an object of class genind
into a text file compatible with
GENEPOP software (Rousset, 2008).
This function can handle genetic data with different allele coding: 2 or 3 digit coding for microsatellite data or 2 digit coding for SNPs (A,C,T,G become respectively 01, 02, 03, 04).
When individuals in input data are not ordered by populations, individuals from the same population can be separated by individuals from other populations. It can be problematic when calculating then pairwise distance matrices. Therefore, in such a case, individuals are ordered by populations and populations ordered in alphabetic order.
P. Savary
raymond1995genepopgraph4lg
For more details about GENEPOP file formatting :
https://genepop.curtin.edu.au:443/help_input.html.
For the opposite conversion, see genepop_to_genind
.
The output file can be used to compute pairwise FST matrix
with mat_pw_fst
data(data_ex_genind)
x <- data_ex_genind
df_genepop <- suppressWarnings(genind_to_genepop(x,
output = "data.frame"))
Run the code above in your browser using DataLab