gl.filter.heterozygosity: Filters individuals with average heterozygosity greater than...

View source: R/gl.filter.heterozygosity.r

gl.filter.heterozygosityR Documentation

Filters individuals with average heterozygosity greater than a specified upper threshold or less than a specified lower threshold

Description

Calculates the observed heterozygosity for each individual in a genlight object and filters individuals based on specified threshold values. Use gl.report.heterozygosity to determine the appropriate thresholds.

Usage

gl.filter.heterozygosity(x, t.upper = 0.7, t.lower = 0, verbose = NULL)

Arguments

x

A genlight object containing the SNP genotypes [required].

t.upper

Filter individuals > the threshold [default 0.7].

t.lower

Filter individuals < the threshold [default 0].

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

Individuals with observed heterozygosity in the interval [t.lower, t.upper] (boundaries included) are retained. Individuals whose heterozygosity cannot be computed (all genotypes missing) are removed, because they cannot be assessed against the thresholds.

Removing individuals invalidates the locus metrics that depend on the composition of individuals (CallRate, allele frequencies, PIC values and the like); when individuals are removed, the corresponding locus-metric flags are reset so that downstream functions know to recalculate them (use gl.recalc.metrics to recalculate immediately).

Value

The filtered genlight object.

Author(s)

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

See Also

gl.report.heterozygosity

Other matched filter: gl.filter.allna(), gl.filter.callrate(), gl.filter.contamination(), gl.filter.excess.het(), gl.filter.factorloadings(), gl.filter.hamming(), gl.filter.hwe(), gl.filter.ld(), gl.filter.locmetric(), gl.filter.maf(), gl.filter.monomorphs(), gl.filter.overshoot(), gl.filter.pa(), gl.filter.rdepth(), gl.filter.replicates(), gl.filter.replicates.KING(), gl.filter.reproducibility(), gl.filter.secondaries(), gl.filter.taglength()

Examples

if (isTRUE(getOption("dartR_fbm"))) testset.gl <- gl.gen2fbm(testset.gl)
 result <- gl.filter.heterozygosity(testset.gl,t.upper=0.06,verbose=3)
 tmp <- gl.report.heterozygosity(result,method='ind')

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