| gl2structure | R Documentation |
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.
gl2structure(
x,
ind.names = NULL,
add.columns = NULL,
ploidy = 2,
export.marker.names = TRUE,
outfile = "gl.str",
outpath = NULL,
verbose = NULL
)
x |
Name of the genlight object containing the SNP data [required]. |
ind.names |
Specify individuals names to be added [if NULL, defaults to indNames(x)]. |
add.columns |
Additional columns to be added before genotypes [default NULL]. |
ploidy |
Set the ploidy [defaults 2]. |
export.marker.names |
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 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]. |
Each individual is written as ploidy rows (two for diploid data), with genotypes coded as allele pairs (0 -> 1/1, 1 -> 1/2, 2 -> 2/2) and missing data as -9. If export.marker.names is TRUE, a header row of locus names precedes the data.
returns no value (i.e. NULL)
Author(s): Bernd Gruber (wrapper), Lindsay V. Clark (lvclark@illinois.edu). Custodian: Bernd Gruber – Post to https://groups.google.com/d/forum/dartr
Other linker:
gi2gl(),
gl2bayesAss(),
gl2bayescan(),
gl2bpp(),
gl2demerelate(),
gl2eigenstrat(),
gl2faststructure(),
gl2gapit(),
gl2gds(),
gl2genalex(),
gl2genepop(),
gl2geno(),
gl2gi(),
gl2hapmap(),
gl2hiphop(),
gl2related(),
gl2snapper(),
gl2treemix(),
gl2vcf()
if (isTRUE(getOption("dartR_fbm"))) testset.gl <- gl.gen2fbm(testset.gl)
gl2structure(testset.gl[1:10,1:50], outpath=tempdir())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.