VcfFile-class: Manipulate Variant Call Format (Vcf) files.

Description usage arguments Objects from the Class Fields Functions and methods Author(s) Examples

Description

Use VcfFile() to create a reference to a Vcf file (and its index). Once opened, the reference remains open across calls to methods, avoiding costly index re-loading.

VcfFileList() provides a convenient way of managing a list of VcfFile instances.

usage

## Constructors

VcfFile(file, index = paste(file, "tbi", sep="."), ..., yieldSize=NA_integer_)

VcfFileList(..., yieldSize=NA_integer_)

## Accessors

index(object)

path(object, ...)

isOpen(con, rw="")

yieldSize(object, ...)

yieldSize(object, ...) <- value

show(object)

## Opening / closing

open(con, ...)

close(con, ...)

## method

vcfFields(object)

arguments

Objects from the Class

Objects are created by calls of the form VcfFile().

Fields

VcfFile and VcfFileList classes inherit fields from the TabixFile and TabixFileList classes.

Functions and methods

VcfFile and VcfFileList classes inherit methods from the TabixFile and TabixFileList classes.

## Opening / closing:

open

Opens the (local or remote) path and index. Returns a VcfFile instance. yieldSize determines the number of records parsed during each call to scanVcf or readVcf; NA indicates that all records are to be parsed.

close

Closes the VcfFile con; returning (invisibly) the updated VcfFile. The instance may be re-opened with open.VcfFile.

## Accessors:

path

Returns a character(1) vector of the Vcf path name.

index

Returns a character(1) vector of Vcf index (tabix file) name.

yieldSize, yieldSize<-

Return or set an integer(1) vector indicating yield size.

## Methods:

vcfFields

Returns a CharacterList of all available VCF fields, with names of fixed, info, geno and samples indicating the four categories. Each element is a character() vector of available VCF field names within each category. It works for both local and remote vcf file.

Author(s)

Valerie Obenchain

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
fl <- system.file("extdata", "chr7-sub.vcf.gz", package="VariantAnnotation",
                  mustWork=TRUE)
vcffile <- VcfFile(fl)
vcffile
vcfFields(fl)
vcfFields(vcffile)

param <- GRanges("7", IRanges(c(55000000,  55900000), width=10000))
vcf <- readVcf(vcffile, "hg19", param=param)
dim(vcf)

## `vcfFields` also works for remote vcf filepath.  
## Not run: 
chr22url <- "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20130502/ALL.chr22.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz"
vcfFields(chr22url)

## End(Not run)

Jiefei-Wang/VariantAnnotation documentation built on March 19, 2020, 12:03 a.m.