Learn R Programming

dartR (version 1.9.9.1)

gl2structure: Converts genlight objects to STRUCTURE formated files

Description

This function exports genlight objects to STRUCTURE formatted files (be aware there is a gl2faststructure version as well). It is based on the code provided by Lindsay Clark (see https://github.com/lvclark/R_genetics_conv) and this function is basically a wrapper around her numeric2structure function. See also: Lindsay Clark. (2017, August 22). lvclark/R_genetics_conv: R_genetics_conv 1.1 (Version v1.1). Zenodo: doi.org/10.5281/zenodo.846816.

Usage

gl2structure(
  x,
  indNames = NULL,
  addcolumns = NULL,
  ploidy = 2,
  exportMarkerNames = TRUE,
  outfile = "gl.str",
  outpath = tempdir(),
  verbose = NULL
)

Arguments

x

-- name of the genlight object containing the SNP data and location data, lat longs [required]

indNames

-- specify individuals names to be added [if NULL, defaults to indNames(x)]

addcolumns

-- additional columns to be added before genotypes [default NULL]

ploidy

-- set the ploidy [defaults 2]

exportMarkerNames

-- if TRUE, locus names locNames(x) will be included [default TRUE]

outfile

-- file name of the output file (including extension) [default gl.str]

outpath

-- path where to save the output file [default tempdir(), mandated by CRAN]. Use outpath=getwd() or outpath="." when calling this function to direct output files to your working directory.

verbose

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

Examples

Run this code
# NOT RUN {
#not run here
#gl2structure(testset.gl)
# }

Run the code above in your browser using DataLab