gl2genepop: Converts a genlight object into genepop format (and file)

gl2genepopR Documentation

Converts a genlight object into genepop format (and file)

Description

The genepop format is used by several external applications (for example Neestimator2. Unfortunatelly, the software seems to be no longer easily available. To install use the gl.download.binary function. So the main idea is to create the genepop file and then run the other software externally. As a feature, the genepop file is also returned as an invisible data.frame by the function.

Usage

gl2genepop(
  x,
  outfile = "genepop.gen",
  outpath = NULL,
  pop.order = "alphabetic",
  output.format = "2_digits",
  verbose = NULL
)

Arguments

x

Name of the genlight object containing the SNP data [required].

outfile

File name of the output file [default 'genepop.gen'].

outpath

Path where to save the output file [default global working directory or if not specified, tempdir()].

pop.order

Order of the output populations either "alphabetic" or a vector of population names in the order required by the user (see examples) [default "alphabetic"].

output.format

Whether to use a 2-digit format ("2_digits") or 3-digits format ("3_digits") [default "2_digits"].

verbose

Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2, unless specified using gl.set.verbosity].

Value

Invisible data frame in genepop format

Author(s)

Custodian: Bernd Gruber (Post to https://groups.google.com/d/forum/dartr)

See Also

Other linker: gl2bayesAss(), gl2bayescan(), gl2bpp(), gl2demerelate(), gl2eigenstrat(), gl2faststructure(), gl2gds(), gl2genalex(), gl2geno(), gl2gi(), gl2hiphop(), gl2phylip(), gl2plink(), gl2related(), gl2sa(), gl2structure(), gl2treemix(), gl2vcf()

Examples


require("dartR.data")
# SNP data
geno <- gl2genepop(possums.gl[1:3,1:9], outpath = tempdir())
head(geno)
test <- gl.filter.callrate(platypus.gl,threshold = 1)
popNames(test)
gl2genepop(test, pop.order = c("TENTERFIELD","SEVERN_ABOVE","SEVERN_BELOW"),
           output.format="3_digits", outpath = tempdir())



dartR.base documentation built on April 4, 2025, 2:45 a.m.