gl2bayesAss: Converts a genlight object into bayesAss (BA3) input format

View source: R/gl2bayesAss.R

gl2bayesAssR Documentation

Converts a genlight object into bayesAss (BA3) input format

Description

This function exports a genlight object into bayesAss format and saves it into a file. This function only caters for ploidy = 2.

Usage

gl2bayesAss(
  x,
  ploidy = 2,
  outfile = "gl.BayesAss.txt",
  outpath = NULL,
  verbose = NULL
)

Arguments

x

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

ploidy

Confirmation that the data are diploid; 2 is the only accepted value, other values stop the function [default 2].

outfile

File name of the output file [default 'gl.BayesAss.txt'].

outpath

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

verbose

Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default NULL, adopting the global verbosity set by gl.set.verbosity(), or 2 if no global is set].

Details

The output file has one row per individual per locus, in the format expected by BayesAss (BA3) and BA3-SNPs: individual identifier, population, locus name, then the two alleles coded as 1 (reference) and 2 (alternate). Missing genotypes are written as 0 0.

Value

returns the input file as data.table

Author(s)

Author(s): Carlo Pacioni. Custodian: Carlo Pacioni – Post to https://groups.google.com/d/forum/dartr

References

Mussmann S. M., Douglas M. R., Chafin T. K. and Douglas M. E. (2019) BA3-SNPs: Contemporary migration reconfigured in BayesAss for next-generation sequence data. Methods in Ecology and Evolution 10, 1808-1813.

Wilson G. A. and Rannala B. (2003) Bayesian Inference of Recent Migration Rates Using Multilocus Genotypes. Genetics 163, 1177-1191.

See Also

Other linker: gi2gl(), gl2bayescan(), gl2bpp(), gl2demerelate(), gl2eigenstrat(), gl2faststructure(), gl2gapit(), gl2gds(), gl2genalex(), gl2genepop(), gl2geno(), gl2gi(), gl2hapmap(), gl2hiphop(), gl2related(), gl2snapper(), gl2structure(), gl2treemix(), gl2vcf()

Examples

require("dartR.data")
#only the first 100 due to check time
if (isTRUE(getOption("dartR_fbm"))) platypus.gl <- gl.gen2fbm(platypus.gl)
gl2bayesAss(platypus.gl[,1:100], outpath=tempdir())

dartR.base documentation built on Nov. 18, 2026, 9:06 a.m.