Selecting and classifying variants with VariantAnnotation
In variant calling pipelines, we’ll often want to do subsequent analysis steps that need further filtering or classification based on the features of the individual variants, such as the depth of coverage in the alternative allele. This is best done from a VCF file, and a common protocol is to save a VCF of all variants found and experiment with filtering that. In this recipe, we’ll look at taking an input VCF and filtering it to retain variants in which the alternative allele is the major allele in the sample.
Getting ready
We’ll need a tabix index VCF file; one is provided in the rbioinfcookbook
package. To extract it, we’ll use the fs
package. For analysis, we shall use the VariantAnnotation
Bioconductor package.
How to do it…
Selecting and classifying variants with VariantAnnotation
can be done as follows:
- Create a prefilter function:
library(VariantAnnotation)is_not_microsat...