Description Usage Arguments Objects from the Class Fields Functions and methods Author(s) Examples
Use BcfFile() to create a reference to a BCF (and optionally
its index). The reference remains open across calls to methods,
avoiding costly index re-loading.
BcfFileList() provides a convenient way of managing a list of
BcfFile instances.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Constructors
BcfFile(file, index = file,
mode=ifelse(grepl("\\.bcf$", file), "rb", "r"))
BcfFileList(...)
## Opening / closing
## S3 method for class 'BcfFile'
open(con, ...)
## S3 method for class 'BcfFile'
close(con, ...)
## accessors; also path(), index()
## S4 method for signature 'BcfFile'
isOpen(con, rw="")
bcfMode(object)
## actions
## S4 method for signature 'BcfFile'
scanBcfHeader(file, ...)
## S4 method for signature 'BcfFile'
scanBcf(file, ..., param=ScanBcfParam())
## S4 method for signature 'BcfFile'
indexBcf(file, ...)
|
con, object |
An instance of |
file |
A character(1) vector of the BCF file path or, (for
indexBcf) an instance of |
index |
A character(1) vector of the BCF index. |
mode |
A character(1) vector; |
param |
An optional |
... |
Additional arguments. For |
rw |
Mode of file; ignored. |
Objects are created by calls of the form BcfFile().
The BcfFile class inherits fields from the
RsamtoolsFile class.
BcfFileList inherits methods from
RsamtoolsFileList and SimpleList.
Opening / closing:
Opens the (local or remote) path and
index (if bamIndex is not character(0)),
files. Returns a BcfFile instance.
Closes the BcfFile con; returning
(invisibly) the updated BcfFile. The instance may be
re-opened with open.BcfFile.
Accessors:
Returns a character(1) vector of the BCF path name.
Returns a character(1) vector of BCF index name.
Returns a character(1) vector BCF mode.
Methods:
Visit the path in path(file), returning the
result of scanBcf applied to the specified path.
Compactly display the object.
Martin Morgan
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | fl <- system.file("extdata", "ex1.bcf.gz", package="Rsamtools",
mustWork=TRUE)
bf <- BcfFile(fl) # implicit index
bf
identical(scanBcf(bf), scanBcf(fl))
rng <- GRanges(c("seq1", "seq2"), IRanges(1, c(1575, 1584)))
param <- ScanBcfParam(which=rng)
bcf <- scanBcf(bf, param=param) ## all ranges
## ranges one at a time 'bf'
open(bf)
sapply(seq_len(length(rng)), function(i, bcfFile, rng) {
param <- ScanBcfParam(which=rng)
bcf <- scanBcf(bcfFile, param=param)[[1]]
## do extensive work with bcf
isOpen(bf) ## file remains open
}, bf, rng)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.