gl2gi: Converts a genlight object to genind object

View source: R/gl2gi.r

gl2giR Documentation

Converts a genlight object to genind object

Description

Converts a genlight object containing SNP data into a genind object (package adegenet), retaining individual names, populations and locus metadata.

Usage

gl2gi(x, probar = FALSE, verbose = NULL)

Arguments

x

A genlight object [required].

probar

If TRUE, a progress bar is displayed for long loops [default FALSE]. Retained for backward compatibility; the vectorised conversion completes without one.

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

This function uses a faster version of df2genind (from the adegenet package).

Loci scored as missing (NA) across all individuals are removed before conversion, with a warning at verbose >= 1 – df2genind would remove them silently, leaving the locus metadata out of register with the genotypes. When the genlight object carries no allele definitions (loc.all is NULL), placeholder alleles are fabricated (A/T for each locus, C/G for the first) and a warning is issued at verbose >= 1; the fabricated labels are placeholders, not sequence data.

Value

A genind object, with all slots filled.

Author(s)

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

See Also

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

Examples

if (isTRUE(getOption("dartR_fbm"))) possums.gl <- gl.gen2fbm(possums.gl)
gl2gi(possums.gl[1:10,1:20])


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

Related to gl2gi in dartR.base...