ScanVcfParam-class {VariantAnnotation} | R Documentation |
Use ScanVcfParam()
to create a parameter object influencing
which records and fields are imported from a VCF file. Record
parsing is based on genomic coordinates and requires a Tabix index
file. Individual VCF elements can be specified in the ‘fixed’,
‘info’, ‘geno’ and ‘samples’ arguments.
ScanVcfParam(fixed=character(), info=character(), geno=character(), samples=character(), trimEmpty=TRUE, which, ...) ## Getters and Setters vcfFixed(object) vcfFixed(object) <- value vcfInfo(object) vcfInfo(object) <- value vcfGeno(object) vcfGeno(object) <- value vcfSamples(object) vcfSamples(object) <- value vcfTrimEmpty(object) vcfTrimEmpty(object) <- value vcfWhich(object) vcfWhich(object) <- value
fixed |
A character() vector of fixed fields to be returned. Possible
values are ALT, QUAL and FILTER. The CHROM, POS, ID and REF fields are
needed to create the |
info |
A character() vector naming the ‘INFO’ fields to return.
|
geno |
A character() vector naming the ‘GENO’ fields to return.
|
samples |
A character() vector of sample names to return.
|
trimEmpty |
A logical(1) indicating whether ‘GENO’ fields with no values should be returned. |
which |
A |
object |
An instance of class |
value |
An instance of the corresponding slot, to be assigned to
|
... |
Arguments passed to methods. |
Objects can be created by calls of the form ScanVcfParam()
.
which
:Object of class "IntegerRangesList"
indicating
which reference sequence and coordinate variants must overlap.
fixed
:Object of class "character"
indicating
fixed fields to be returned.
info
:Object of class "character"
indicating
portions of ‘INFO’ to be returned.
geno
:Object of class "character"
indicating
portions of ‘GENO’ to be returned.
samples
:Object of class "character"
indicating
the samples to be returned.
trimEmpty
:Object of class "logical"
indicating
whether empty ‘GENO’ fields are to be returned.
See 'Usage' for details on invocation.
Constructor:
Returns a ScanVcfParam
object.
The which
argument to the constructor can be one of several types,
as documented above.
Accessors:
Return the corresponding field from object
.
Methods:
Compactly display the object.
Martin Morgan and Valerie Obenchain
ScanVcfParam() fl <- system.file("extdata", "structural.vcf", package="VariantAnnotation") compressVcf <- bgzip(fl, tempfile()) idx <- indexTabix(compressVcf, "vcf") tab <- TabixFile(compressVcf, idx) ## --------------------------------------------------------------------- ## 'which' argument ## --------------------------------------------------------------------- ## To subset on genomic coordinates, supply an object ## containing the ranges of interest. These ranges can ## be given directly to the 'param' argument or wrapped ## inside ScanVcfParam() as the 'which' argument. ## When using a list, the outer list names must correspond to valid ## chromosome names in the vcf file. In this example they are "1" ## and "2". gr1 <- GRanges("1", IRanges(13219, 2827695, name="regionA")) gr2 <- GRanges(rep("2", 2), IRanges(c(321680, 14477080), c(321689, 14477090), name=c("regionB", "regionC"))) grl <- GRangesList("1"=gr1, "2"=gr2) vcf <- readVcf(tab, "hg19", grl) ## Names of the ranges are in the 'paramRangeID' metadata column of the ## GRanges object returned by the rowRanges() accessor. rowRanges(vcf) ## which can be used for subsetting the VCF object vcf[rowRanges(vcf)$paramRangeID == "regionA"] ## When using ranges, the seqnames must correspond to valid ## chromosome names in the vcf file. gr <- unlist(grl, use.names=FALSE) vcf <- readVcf(tab, "hg19", gr) ## --------------------------------------------------------------------- ## 'fixed', 'info', 'geno' and 'samples' arguments ## --------------------------------------------------------------------- ## This param specifies the "GT" 'geno' field for a single sample ## and the subset of ranges in 'which'. All 'fixed' and 'info' fields ## will be returned. ScanVcfParam(geno="GT", samples="NA00002", which=gr) ## Here two 'fixed' and one 'geno' field are specified ScanVcfParam(fixed=c("ALT", "QUAL"), geno="GT", info=NA) ## Return only the 'fixed' fields ScanVcfParam(geno=NA, info=NA)