filter.rare.variants {Ravages} | R Documentation |
Rare variants filtering
Description
Filter rare variants based on a MAF threshold and a given number of SNP or a given cumulative MAF per genomic region
Usage
filter.rare.variants(x, ref.level = NULL, filter=c("whole", "controls", "any"),
maf.threshold=0.01, min.nb.snps = 2, min.cumulative.maf = NULL,
group = NULL, genomic.region = NULL)
Arguments
x |
A bed.matrix |
ref.level |
The level corresponding to the controls group, only needed if |
filter |
On which group the filter will be applied |
maf.threshold |
The MAF threshold used to define a rare variant, set at 0.01 by default |
min.nb.snps |
The minimum number of variants needed to keep a genomic region, set at 2 by default |
min.cumulative.maf |
The minimum cumulative maf of variants needed to keep a genomic region |
group |
A factor indicating the group of each individual, only needed if |
genomic.region |
An optional factor containing the genomic region of each variant, only needed if |
Details
To use this function, a factor 'genomic.region' should be present in the slot x@snps
.
If filter="whole"
, only the variants having a MAF lower than the threshold in the entire sample are kept.
If filter="controls"
, only the variants having a MAF lower than the threshold in the controls group are kept.
If filter="any"
, only the variants having a MAF lower than the threshold in any of the groups are kept.
Value
A bed.matrix with filtered variants
Examples
#Import 1000Genome data from region around LCT gene
x <- as.bed.matrix(LCT.gen, LCT.fam, LCT.bim)
#Group variants within known genes
x <- set.genomic.region(x)
table(x@snps$genomic.region, useNA="ifany")
#Filter of rare variants: only non-monomorphic variants with
#a MAF lower than 2.5%
#keeping only genomic regions with at least 10 SNPs
x1 <- filter.rare.variants(x, filter = "whole", maf.threshold = 0.025, min.nb.snps = 10)
table(x1@snps$genomic.region, useNA="ifany")
#Keep only variants with a MAF<2%
#and regions with a cumulative MAF>10%
filter.rare.variants(x, filter = "whole", maf.threshold = 0.02, min.nb.snps = 1,
min.cumulative.maf=0.2)