50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

VariantTools (version 1.14.1)

postFilterVariants: Post-filtering of Variants

Description

Applies filters to a set of called variants. The only current filter is a cutoff on the weighted neighbor count of each variant. This filtering is performed automatically by callVariants, so these functions are for when more control is desired.

Usage

postFilterVariants(x, post.filters = VariantPostFilters(...), ...) VariantPostFilters(max.nbor.count = 0.1, whitelist = NULL)

Arguments

x
A tally GRanges containing called variants, as output by callVariants.
post.filters
The filters applied to the called variants.
...
Arguments passed to VariantPostFilters, listed below.
max.nbor.count
Maximum allowed number of neighbors (weighted by distance)
whitelist
Positions to ignore; these will always pass the filter, and are excluded from the neighbor counting.

Value

For postFilterVariants, a tally GRanges of the variants that pass the filters.For VariantPostFilters, a FilterRules object with the filters.

Details

The neighbor count is calculated within a 100bp window centered on the variant. Each neighbor is weighted by the inverse square root of the distance to the neighbor. This was motivated by fitting logistic regression models including a term the count (usually 0, 1, 2) at each distance. The inverse square root function best matched the trend in the coefficients.

Examples

Run this code
p53 <- gmapR:::exonsOnTP53Genome("TP53")
bams <- LungCancerLines::LungCancerBamFiles()
tally.param <- TallyVariantsParam(gmapR::TP53Genome(), 
                                  high_base_quality = 23L,
                                  which = range(p53))
# post-filters are not enabled by default during calling
called.variants <- callVariants(bams[[1]], tally.param)
# but can be applied at a later time...
postFilterVariants(called.variants, max.nbor.count = 0.15)

# or enable during calling
called.variants <- callVariants(bams[[1]], tally.param,
                                post.filters = VariantPostFilters())

Run the code above in your browser using DataLab