gl.filter.ld: Filters loci based on linkage disequilibrium (LD)

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

gl.filter.ldR Documentation

Filters loci based on linkage disequilibrium (LD)

Description

This function uses the statistic set in the parameter stat.keep from function gl.report.ld.map to choose the SNP to keep when two SNPs are in LD. When a SNP is selected to be filtered out in a pairwise comparison, the function stores its name in a list; a SNP already in the list is not listed again.

Usage

gl.filter.ld(x, ld.report, threshold = 0.2, pop.limit = NULL, verbose = NULL)

Arguments

x

Name of the genlight object containing the SNP data [required].

ld.report

Output from function gl.report.ld.map [required].

threshold

Threshold value at or above which loci will be removed [default 0.2].

pop.limit

Minimum number of populations in which LD should be more than the threshold for a locus to be filtered out [default half of the populations represented in ld.report, i.e. ceiling(n/2)].

verbose

Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2, unless specified using gl.set.verbosity].

Details

Within each population, the pairs reported by gl.report.ld.map with ld.stat at or above threshold are processed in the order they appear in the report. For each pair, the locus with the lower stat.keep value is marked for removal. Note that comparisons are strictly pairwise and sequential: a locus can be marked for removal against a partner that was itself marked by an earlier comparison. A locus is removed from the dataset when it is marked in at least pop.limit populations.

Value

The reduced genlight object (returned invisibly).

Author(s)

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

See Also

gl.report.ld.map

Other matched filter: gl.filter.allna(), gl.filter.callrate(), gl.filter.contamination(), gl.filter.excess.het(), gl.filter.factorloadings(), gl.filter.hamming(), gl.filter.heterozygosity(), gl.filter.hwe(), 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"))) platypus.gl <- gl.gen2fbm(platypus.gl)
test <- gl.filter.callrate(platypus.gl, threshold = 1)
test <- gl.filter.monomorphs(test)
res <- gl.report.ld.map(test)
res_2 <- gl.filter.ld(x = test, ld.report = res)


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