read.vcf: Read VCF

Description Usage Arguments Details Value Examples

Description

Read a VCF file and return the called SNVs as a GRanges instance. Only SNVs with a single ALT allele are returned, and, by default, all filtered SNVs are excluded from the returned value.

Usage

1
2
read.vcf(f, genome, exclude.filtered = TRUE, read.info = FALSE,
  read.geno = FALSE, filter.func = NULL)

Arguments

f

A TabixFile instance or character() name of the VCF file to be processed.

genome

A genome identifier.

exclude.filtered

filt

read.info

Read INFO field, default is to ignore the INFO field. Set this to TRUE if INFO fields are required in the filter function (see Details).

read.geno

Read genotypes from VCF, the default is to ignore the genotypes. Set this to TRUE if genotypes are needed in the filter function (see Details).

filter.func

a function used to filter variants from the returned GRanges

Details

details

Value

A VCF instance from the VariantAnnotation package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
# To simply read a VCF excluding filtered variants use
x <- read.vcf(f, 'hg19', read.info = TRUE, filter.func = func)

# For more complicated filtering you can pass a filter function.  This
# example assuming the VCF has been annotated with SnpEff and we are only
# interested in variants that have not been filtered and have a SnpEff
# impact of HIGH or MODERATE.

func <- function(vcf) {
  x <- rowData(vcf)
  x[unlist(lapply(info(vcf)$EFF,
    function(x) any(grepl('(HIGH)|(MODERATE)', x))))]
}

f <- system.file('extdata', 'example.vcf', package = 'GenomicVis')
x <- read.vcf(f, 'hg19', read.info = TRUE, filter.func = func)

## End(Not run)

jjellis/GenomicVis documentation built on May 19, 2019, 11:39 a.m.