gl2treemix: Converts a genlight object to a treemix input file

View source: R/gl2treemix.r

gl2treemixR Documentation

Converts a genlight object to a treemix input file

Description

The output file contains the SNP data in the format expected by treemix – see the treemix manual. The file will be gzipped before in order to be recognised by treemix. Plotting functions provided with treemix will need to be sourced from the treemix download page.

Usage

gl2treemix(x, outfile = "treemix_input.gz", outpath = NULL, verbose = NULL)

Arguments

x

Name of the genlight object [required].

outfile

File name of the output file (including gz extension) [default 'treemix_input.gz'].

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 a header row of population names followed by one row per locus, each cell holding the reference and alternate allele counts for that population as 'ref,alt'.

Value

returns no value (i.e. NULL)

Author(s)

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

References

Pickrell and Pritchard (2012). Inference of population splits and mixtures from genome-wide allele frequency data. PLoS Genetics https://doi.org/10.1371/journal.pgen.1002967

See Also

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

Examples

if (isTRUE(getOption("dartR_fbm"))) testset.gl <- gl.gen2fbm(testset.gl)
gl2treemix(testset.gl, outpath=tempdir())


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