gl.filter.rdepth: Filters loci based on counts of sequence tags scored at a...

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

gl.filter.rdepthR Documentation

Filters loci based on counts of sequence tags scored at a locus (read depth)

Description

SNP datasets generated by DArT report AvgCountRef and AvgCountSnp as counts of sequence tags for the reference and alternate alleles respectively. These can be used to back calculate Read Depth. Fragment presence/absence datasets as provided by DArT (SilicoDArT) provide Average Read Depth and Standard Deviation of Read Depth as standard columns in their report.

This function filters out loci with a read depth below the lower threshold or above the upper threshold. Loci with a read depth equal to a threshold are retained. Use the companion function gl.report.rdepth to choose the thresholds.

Usage

gl.filter.rdepth(
  x,
  lower = 5,
  upper = 1000,
  plot.display = TRUE,
  plot.theme = theme_dartR(),
  plot.colors = NULL,
  plot.file = NULL,
  plot.dir = NULL,
  verbose = NULL
)

Arguments

x

Name of the genlight object containing the SNP or tag presence/absence data [required].

lower

Lower threshold value below which loci will be removed [default 5].

upper

Upper threshold value above which loci will be removed [default 1000].

plot.display

If TRUE, histograms of read depth before and after filtering are displayed in the plot window [default TRUE].

plot.theme

Theme for the plot. See Details for options [default theme_dartR()].

plot.colors

List of two color names for the borders and fill of the plots [default c("#2171B5", "#6BAED6")].

plot.file

Name for the RDS binary file to save (base name only, exclude extension) [default NULL]

plot.dir

Directory in which to save files [default = working directory]

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

Loci for which the read depth metric is missing (NA) are removed, because they cannot be assessed against the thresholds.

For examples of themes, see:

Value

Returns a genlight object retaining loci with a Read Depth in the range specified by the lower and upper threshold.

Author(s)

Custodian: Arthur Georges. Author(s): Arthur Georges (Post to https://groups.google.com/d/forum/dartr)

See Also

gl.report.rdepth

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.ld(), gl.filter.locmetric(), gl.filter.maf(), gl.filter.monomorphs(), gl.filter.overshoot(), gl.filter.pa(), gl.filter.replicates(), gl.filter.replicates.KING(), gl.filter.reproducibility(), gl.filter.secondaries(), gl.filter.taglength()

Examples

 
# SNP data
if (isTRUE(getOption("dartR_fbm"))) testset.gl <- gl.gen2fbm(testset.gl)
  gl.report.rdepth(testset.gl)
  result <- gl.filter.rdepth(testset.gl, lower=8, upper=50, verbose=3)
# Tag P/A data
  result <- gl.filter.rdepth(testset.gs, lower=8, upper=50, verbose=3)
  
require("dartR.data")
res <- gl.filter.rdepth(platypus.gl)

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