Learn R Programming

poppr (version 2.9.6)

filter_stats: Utilize all algorithms of mlg.filter

Description

This function is a wrapper to mlg.filter. It will calculate all of the stats for mlg.filter utilizing all of the algorithms.

Usage

filter_stats(
  x,
  distance = bitwise.dist,
  threshold = 1e+06 + .Machine$double.eps^0.5,
  stats = "All",
  missing = "ignore",
  plot = FALSE,
  cols = NULL,
  nclone = NULL,
  hist = "Scott",
  threads = 1L,
  ...
)

Value

a list of results from mlg.filter from the three algorithms. (returns invisibly if plot = TRUE)

Arguments

x

a genind, genclone, genlight, or snpclone object

distance

a distance function or matrix

threshold

a threshold to be passed to mlg.filter (Default: 1e6)

stats

what statistics should be calculated.

missing

how to treat missing data with mlg.filter

plot

If the threshold is a maximum threshold, should the statistics be plotted (Figure 2)

cols

the colors to use for each algorithm (defaults to set1 of RColorBrewer).

nclone

the number of multilocus genotypes you expect for the data. This will draw horizontal line on the graph at the value nclone and then vertical lines showing the cutoff thresholds for each algorithm.

hist

if you want a histogram to be plotted behind the statistics, select a method here. Available methods are "sturges", "fd", or "scott" (default) as documented in hist. If you don't want to plot the histogram, set hist = NULL.

threads

(unused) Previously the number of threads to be used. As of poppr version 2.4.1, this is by default set to 1.

...

extra parameters passed on to the distance function.

Author

Zhian N. Kamvar, Jonah C. Brooks

References

ZN Kamvar, JC Brooks, and NJ Grünwald. 2015. Supplementary Material for Frontiers Plant Genetics and Genomics 'Novel R tools for analysis of genome-wide population genetic data with emphasis on clonality'. DOI: tools:::Rd_expr_doi("10.5281/zenodo.17424")

Kamvar ZN, Brooks JC and Grünwald NJ (2015) Novel R tools for analysis of genome-wide population genetic data with emphasis on clonality. Front. Genet. 6:208. doi: tools:::Rd_expr_doi("10.3389/fgene.2015.00208")

See Also

mlg.filter cutoff_predictor bitwise.dist diss.dist

Examples

Run this code

# Basic usage example: Bruvo's Distance --------------------------------
data(Pinf)
pinfreps <- fix_replen(Pinf, c(2, 2, 6, 2, 2, 2, 2, 2, 3, 3, 2))
bres <- filter_stats(Pinf, distance = bruvo.dist, replen = pinfreps, plot = TRUE, threads = 1L)
print(bres) # shows all of the statistics

# Use these results with cutoff_filter()
print(thresh <- cutoff_predictor(bres$farthest$THRESHOLDS))
mlg.filter(Pinf, distance = bruvo.dist, replen = pinfreps) <- thresh
Pinf 

# Different distances will give different results -----------------------
nres <- filter_stats(Pinf, distance = nei.dist, plot = TRUE, threads = 1L, missing = "mean")
print(thresh <- cutoff_predictor(nres$farthest$THRESHOLDS))
mlg.filter(Pinf, distance = nei.dist, missing = "mean") <- thresh
Pinf 

Run the code above in your browser using DataLab