glSum: Sum of the second allele per locus, for dartR and genlight...

View source: R/utils.dartR.class.def.r

glSumR Documentation

Sum of the second allele per locus, for dartR and genlight objects

Description

Returns, for each locus, the number of copies of the second (alternative) allele summed over individuals, ignoring missing data. It replaces adegenet::glSum so that FBM-backed dartR objects (see gl.gen2fbm) are handled; other objects are passed to adegenet::glSum and give identical results.

Usage

glSum(x, alleleAsUnit = TRUE, useC = FALSE)

Arguments

x

Name of the dartR or genlight object [required].

alleleAsUnit

If TRUE, the sum counts alleles; if FALSE, each genotype is first divided by the individual's ploidy, so the sum counts individuals [default TRUE].

useC

Passed through to adegenet::glSum for non-FBM objects [default FALSE].

Value

A named numeric vector with one value per locus; integer for alleleAsUnit = TRUE. Loci with no data give 0.

Author(s)

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

Examples

head(glSum(testset.gl))
fbm.gl <- gl.gen2fbm(testset.gl, verbose = 0)
identical(glSum(fbm.gl), glSum(testset.gl))

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

Related to glSum in dartR.base...