gi2gl: Converts a genind object into a genlight object

View source: R/gi2gl.R

gi2glR Documentation

Converts a genind object into a genlight object

Description

Converts a genind object (package adegenet) containing biallelic SNP data into a genlight object, retaining individual names, populations and the contents of the other slot.

Usage

gi2gl(gi, parallel = FALSE, verbose = NULL)

Arguments

gi

A genind object [required].

parallel

Switch to deactivate parallel version. It might not be worth to run it parallel most of the times [default FALSE].

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

Only diploid genind objects with at most two alleles per locus can be converted; loci with more than two alleles cannot be represented in a genlight object and raise a fatal error naming the offending loci.

Allele spellings are reconstructed from the genind allele names: each locus receives loc.all of the form second/first allele of the genind tab, so the 0/1/2 dosages and the allele pair are mutually consistent. Be aware that due to ambiguity over which allele is the reference, a combination of gi2gl(gl2gi(gl)) does not return an identical object (loci can come back with the complementary dosage and the reversed allele pair), but in terms of analysis the conversions are equivalent.

Value

A genlight 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: gl2bayesAss(), gl2bayescan(), gl2bpp(), gl2demerelate(), gl2eigenstrat(), gl2faststructure(), gl2gapit(), gl2gds(), gl2genalex(), gl2genepop(), gl2geno(), gl2gi(), gl2hapmap(), gl2hiphop(), gl2related(), gl2snapper(), gl2structure(), gl2treemix(), gl2vcf()

Examples

gi <- gl2gi(gl.filter.allna(testset.gl[1:20, 1:50], verbose = 0),
            verbose = 0)
gl <- gi2gl(gi, verbose = 0)


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

Related to gi2gl in dartR.base...