View source: R/gl.filter.contamination.r
| gl.filter.contamination | R Documentation |
Runs the contamination screen of gl.report.contamination
and removes the individuals it flags. Use the report first to check the
candidate list and tune the thresholds; the filter takes the same
parameters.
gl.filter.contamination(
x,
flag = c("suspect", "adjacent", "mixed"),
rare.freq = 0.02,
min.n = 5,
z.flag = 3,
min.excess = 0.02,
rare.min.excess = 0.005,
min.share = 20,
share.tol = 0.05,
depth.ratio = 1.5,
depth.flat = 1.25,
min.reads = 20,
balance.cut = 0.25,
min.calls = 1000,
plate = NULL,
recalc = FALSE,
mono.rm = FALSE,
verbose = NULL
)
x |
Name of the genlight object containing the SNP data [required]. |
flag |
Classes of individual to remove, any of "suspect", "adjacent", "mixed" and "rare-only" [default c("suspect", "adjacent", "mixed")]. |
rare.freq |
Allele frequency in the rest of the population below which an allele counts as rare; must lie in (0, 0.5) [default 0.02]. |
min.n |
Minimum number of other individuals in the population called at a locus for that locus to enter the rare-allele burden; at least 2 [default 5]. |
z.flag |
Robust z-score above which a statistic is an outlier [default 3]. |
min.excess |
Absolute amount by which heterozygosity must also exceed the population median to be flagged [default 0.02]. |
rare.min.excess |
The same absolute margin for the rare-allele burden [default 0.005]. |
min.share |
Minimum number of rare-allele loci an individual needs before its source is chosen by allele sharing rather than by residual kinship alone [default 20]. |
share.tol |
Sharing scores within this distance of the best are treated as ties and separated by residual kinship [default 0.05]. |
depth.ratio |
Foreign-allele rate in the deepest quartile of loci over the shallowest, at or above which the depth pattern is "dose" [default 1.5]. |
depth.flat |
The same ratio below which the pattern is "flat" [default 1.25]. |
min.reads |
Minimum number of reads (REF plus ALT) for a genotype to enter the read-balance test [default 20]. |
balance.cut |
Share of the reads below which the minority allele of a heterozygous call marks it as skewed; must lie in (0, 0.5] [default 0.25]. |
min.calls |
Minimum number of genotypes with at least
|
plate |
Data frame with columns id, plate and well giving the plate
position of each individual; when NULL, positions are taken from
|
recalc |
Recalculate the locus metadata statistics if any individuals are deleted [default FALSE]. |
mono.rm |
Remove monomorphic loci after individuals are deleted [default FALSE]. |
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]. |
The screen is described in gl.report.contamination. In
brief, an individual is a "suspect" when its heterozygosity is a robust
outlier within its population and exceeds the population median by
more than min.excess; a suspect whose strongest residual-kinship
partner sits in an adjacent plate well is "adjacent"; an individual whose
rare-allele burden is elevated but whose heterozygosity is normal is
"rare-only", which points to population structure or mislabelling rather
than contamination; an individual whose read balance marks it as a
mixture of two animals is "mixed" (this needs the read counts kept by
gl.read.vcf(read.counts = TRUE)).
flag names the classes to remove. The default removes "suspect",
"adjacent" and "mixed": the two classes with the heterozygosity signal
that contamination always produces, and the class with direct read
evidence of a mixture, which also covers contamination from the same
population. Add "rare-only" to also remove individuals
that carry an excess of alleles rare in their assigned population, or set
flag = "adjacent" to remove only the suspects with plate evidence.
The tier 3 depth pattern (dose, flat, saturated, unclear) is
printed for each removed individual but does not change the flag or the
filter: a "flat" pattern points to a hybrid, admixed or mislabelled
animal rather than a contaminant, so review such cases before removing
them, for example by dropping them from the screen with
gl.keep.ind or adding them back afterwards.
The screen is a candidate list, not a verdict: a population whose members differ widely in heterozygosity (inbreeding, admixture, relatives) can yield suspects that are not contaminated. Check the report before filtering.
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,
or the metrics are recalculated immediately with recalc = TRUE.
The genlight object with the flagged individuals removed.
Author(s): Luis Mijangos. Custodian: Luis Mijangos – Post to https://groups.google.com/d/forum/dartr
gl.report.contamination,
gl.filter.heterozygosity
Other matched filter:
gl.filter.allna(),
gl.filter.callrate(),
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.rdepth(),
gl.filter.replicates(),
gl.filter.replicates.KING(),
gl.filter.reproducibility(),
gl.filter.secondaries(),
gl.filter.taglength()
if (isTRUE(getOption("dartR_fbm"))) testset.gl <- gl.gen2fbm(testset.gl)
out <- gl.report.contamination(testset.gl, plot.display = FALSE)
gl <- gl.filter.contamination(testset.gl, verbose = 3)
nInd(testset.gl) - nInd(gl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.