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 each pairwise comparison, the function stores its name in a list. In subsequent pairwise comparisons, if the SNP is already in the list, the other SNP will be kept.

Usage

gl.filter.ld(
  x,
  ld_report,
  threshold = 0.2,
  pop.limit = ceiling(nPop(x)/2),
  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 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. The default value is half of the populations [default ceiling(nPop(x)/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].

Value

The reduced genlight object.

Author(s)

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

See Also

gl.report.ld.map

Other filter functions: gl.filter.allna(), gl.filter.callrate(), gl.filter.heterozygosity(), gl.filter.hwe(), gl.filter.locmetric(), gl.filter.maf(), gl.filter.monomorphs(), gl.filter.overshoot(), gl.filter.parent.offspring(), gl.filter.pa(), gl.filter.rdepth(), gl.filter.reproducibility(), gl.filter.secondaries(), gl.filter.sexlinked(), gl.filter.taglength()

Examples

## Not run: 
test <- bandicoot.gl
test <- gl.filter.callrate(test,threshold = 1)
res <- gl.report.ld.map(test)
res_2 <- gl.filter.ld(x=test,ld_report = res)
res_3 <- gl.report.ld.map(res_2)

## End(Not run)
if ((requireNamespace("snpStats", quietly = TRUE)) & (requireNamespace("fields", quietly = TRUE))) {
test <- gl.filter.callrate(platypus.gl, threshold = 1)
test <- gl.filter.monomorphs(test)
test <- test[,1:20]
report <- gl.report.ld.map(test)
res <- gl.filter.ld(x=test,ld_report = report)
}

dartR documentation built on June 8, 2023, 6:48 a.m.