Title: | Representing on-disk / remote VCF files as array-like objects |
---|---|
Description: | VCFArray extends the DelayedArray to represent VCF data entries as array-like objects with on-disk / remote VCF file as backend. Data entries from VCF files, including info fields, FORMAT fields, and the fixed columns (REF, ALT, QUAL, FILTER) could be converted into VCFArray instances with different dimensions. |
Authors: | Qian Liu [aut, cre], Martin Morgan [aut] |
Maintainer: | Qian Liu <[email protected]> |
License: | GPL-3 |
Version: | 1.23.0 |
Built: | 2024-11-18 04:42:03 UTC |
Source: | https://github.com/bioc/VCFArray |
dim
, dimnames
: dimension and dimnames of
object contained in the VCF file.
vcffile
: extract the VcfFile
object
corresponding to the backend VCF file.
rowRanges
: extract the rowRanges
information from the backend VCF file.
## S4 method for signature 'VCFArraySeed' dim(x) ## S4 method for signature 'VCFArraySeed' dimnames(x) vcffile(x) ## S4 method for signature 'VCFArraySeed' vcffile(x) ## S4 method for signature 'VCFArraySeed' rowRanges(x) ## S4 method for signature 'VCFArraySeed' show(object) ## S4 method for signature 'VCFArray' vcffile(x) ## S4 method for signature 'VCFArray' rowRanges(x)
## S4 method for signature 'VCFArraySeed' dim(x) ## S4 method for signature 'VCFArraySeed' dimnames(x) vcffile(x) ## S4 method for signature 'VCFArraySeed' vcffile(x) ## S4 method for signature 'VCFArraySeed' rowRanges(x) ## S4 method for signature 'VCFArraySeed' show(object) ## S4 method for signature 'VCFArray' vcffile(x) ## S4 method for signature 'VCFArray' rowRanges(x)
x |
the |
object |
the |
dim
: the integer vector of dimensions for
VCFArray
or VCFArraySeed
objects.
dimnames
: the unnamed list of dimension names for
VCFArray
and VCFArraySeed
objects.
vcffile
: the VcfFile
object corresponding to
the backend VCF file.
fl <- system.file("extdata", "chr22.vcf.gz", package="VariantAnnotation") va <- VCFArray(fl, name = "GT") dim(va) dimnames(va) vcffile(va) seed(va) dim(seed(va)) DelayedArray::type(va)
fl <- system.file("extdata", "chr22.vcf.gz", package="VariantAnnotation") va <- VCFArray(fl, name = "GT") dim(va) dimnames(va) vcffile(va) seed(va) dim(seed(va)) DelayedArray::type(va)
extract_array
: the function to extract data
from a VCF
file, by taking VCFArraySeed
as
input. This function is required by the DelayedArray
for
the seed contract.
VCFArray
: The function to convert data entries
inside VCF file into the VCFArray
instance.
## S4 method for signature 'VCFArraySeed' extract_array(x, index) VCFArray(file, vindex = character(), name = NA, pfix = NULL)
## S4 method for signature 'VCFArraySeed' extract_array(x, index) VCFArray(file, vindex = character(), name = NA, pfix = NULL)
x |
the VCFArraySeed object |
index |
in |
file |
takes values for charater string (specifying the VCF
file path), |
vindex |
in |
name |
the data entry from VCF file to be read into
VCFArraySeed / VCFArray. For |
pfix |
the category that the |
VCFArray
class object.
fl <- system.file("extdata", "chr22.vcf.gz", package="VariantAnnotation") va <- VCFArray(fl, name = "GT") va vcf <- VariantAnnotation::VcfFile(fl) va1 <- VCFArray(vcf, name = "GT") va1 all.equal(va, va1) ## Not run: ## RangedVcfStack class extdata <- system.file(package = "GenomicFiles", "extdata") files <- dir(extdata, pattern="^CEUtrio.*bgz$", full=TRUE)[1:2] names(files) <- sub(".*_([0-9XY]+).*", "\\1", basename(files)) seqinfo <- as(readRDS(file.path(extdata, "seqinfo.rds")), "Seqinfo") stack <- GenomicFiles::VcfStack(files, seqinfo) gr <- as(GenomicFiles::seqinfo(stack)[rownames(stack)], "GRanges") ## RangedVcfStack rgstack <- GenomicFiles::RangedVcfStack(stack, rowRanges = gr) rgstack va2 <- VCFArray(rgstack, name = "SB") va2 ## End(Not run) ## coercion as(va[1:10, ], "array")
fl <- system.file("extdata", "chr22.vcf.gz", package="VariantAnnotation") va <- VCFArray(fl, name = "GT") va vcf <- VariantAnnotation::VcfFile(fl) va1 <- VCFArray(vcf, name = "GT") va1 all.equal(va, va1) ## Not run: ## RangedVcfStack class extdata <- system.file(package = "GenomicFiles", "extdata") files <- dir(extdata, pattern="^CEUtrio.*bgz$", full=TRUE)[1:2] names(files) <- sub(".*_([0-9XY]+).*", "\\1", basename(files)) seqinfo <- as(readRDS(file.path(extdata, "seqinfo.rds")), "Seqinfo") stack <- GenomicFiles::VcfStack(files, seqinfo) gr <- as(GenomicFiles::seqinfo(stack)[rownames(stack)], "GRanges") ## RangedVcfStack rgstack <- GenomicFiles::RangedVcfStack(stack, rowRanges = gr) rgstack va2 <- VCFArray(rgstack, name = "SB") va2 ## End(Not run) ## coercion as(va[1:10, ], "array")