BamViews {Rsamtools} | R Documentation |
Views into a set of BAM files
Description
Use BamViews()
to reference a set of disk-based BAM files to be
processed (e.g., queried using scanBam
) as a single
‘experiment’.
Usage
## Constructor
BamViews(bamPaths=character(0),
bamIndicies=bamPaths,
bamSamples=DataFrame(row.names=make.unique(basename(bamPaths))),
bamRanges, bamExperiment = list(), ...)
## S4 method for signature 'missing'
BamViews(bamPaths=character(0),
bamIndicies=bamPaths,
bamSamples=DataFrame(row.names=make.unique(basename(bamPaths))),
bamRanges, bamExperiment = list(), ..., auto.range=FALSE)
## Accessors
bamPaths(x)
bamSamples(x)
bamSamples(x) <- value
bamRanges(x)
bamRanges(x) <- value
bamExperiment(x)
## S4 method for signature 'BamViews'
names(x)
## S4 replacement method for signature 'BamViews'
names(x) <- value
## S4 method for signature 'BamViews'
dimnames(x)
## S4 replacement method for signature 'BamViews,ANY'
dimnames(x) <- value
bamDirname(x, ...) <- value
## Subset
## S4 method for signature 'BamViews,ANY,ANY'
x[i, j, ..., drop=TRUE]
## S4 method for signature 'BamViews,ANY,missing'
x[i, j, ..., drop=TRUE]
## S4 method for signature 'BamViews,missing,ANY'
x[i, j, ..., drop=TRUE]
## Input
## S4 method for signature 'BamViews'
scanBam(file, index = file, ..., param = ScanBamParam(what=scanBamWhat()))
## S4 method for signature 'BamViews'
countBam(file, index = file, ..., param = ScanBamParam())
## Show
## S4 method for signature 'BamViews'
show(object)
Arguments
bamPaths |
A character() vector of BAM path names. |
bamIndicies |
A character() vector of BAM index file path names, without the ‘.bai’ extension. |
bamSamples |
A |
bamRanges |
Missing or a |
bamExperiment |
A list() containing additional information about the experiment. |
auto.range |
If |
... |
Additional arguments. |
x |
An instance of |
object |
An instance of |
value |
An object of appropriate type to replace content. |
i |
During subsetting, a logical or numeric index into
|
j |
During subsetting, a logical or numeric index into
|
drop |
A logical(1), ignored by all |
file |
An instance of |
index |
A character vector of indices, corresponding to the
|
param |
An optional |
Objects from the Class
Objects are created by calls of the form BamViews()
.
Slots
- bamPaths
A character() vector of BAM path names.
- bamIndicies
A character() vector of BAM index path names.
- bamSamples
A
DataFrame
instance with as many rows aslength(bamPaths)
, containing sample information associated with each path.- bamRanges
A
GRanges
instance with ranges defined on the spaces of the BAM files. Ranges are not validated against the BAM files.- bamExperiment
A list() containing additional information about the experiment.
Functions and methods
See 'Usage' for details on invocation.
Constructor:
- BamViews:
Returns a
BamViews
object.
Accessors:
- bamPaths
Returns a character() vector of BAM path names.
- bamIndicies
Returns a character() vector of BAM index path names.
- bamSamples
Returns a
DataFrame
instance with as many rows aslength(bamPaths)
, containing sample information associated with each path.- bamSamples<-
Assign a
DataFrame
instance with as many rows aslength(bamPaths)
, containing sample information associated with each path.- bamRanges
Returns a
GRanges
instance with ranges defined on the spaces of the BAM files. Ranges are not validated against the BAM files.- bamRanges<-
Assign a
GRanges
instance with ranges defined on the spaces of the BAM files. Ranges are not validated against the BAM files.- bamExperiment
Returns a list() containing additional information about the experiment.
- names
Return the column names of the
BamViews
instance; same asnames(bamSamples(x))
.- names<-
Assign the column names of the
BamViews
instance.- dimnames
Return the row and column names of the
BamViews
instance.- dimnames<-
Assign the row and column names of the
BamViews
instance.
Methods:
- "["
Subset the object by
bamRanges
orbamSamples
.- scanBam
Visit each path in
bamPaths(file)
, returning the result ofscanBam
applied to the specified path.bamRanges(file)
takes precedence overbamWhich(param)
.- countBam
Visit each path in
bamPaths(file)
, returning the result ofcountBam
applied to the specified path.bamRanges(file)
takes precedence overbamWhich(param)
.- show
Compactly display the object.
Author(s)
Martin Morgan
Examples
fls <- system.file("extdata", "ex1.bam", package="Rsamtools",
mustWork=TRUE)
rngs <- GRanges(seqnames = Rle(c("chr1", "chr2"), c(9, 9)),
ranges = c(IRanges(seq(10000, 90000, 10000), width=500),
IRanges(seq(100000, 900000, 100000), width=5000)),
Count = seq_len(18L))
v <- BamViews(fls, bamRanges=rngs)
v
v[1:5,]
bamRanges(v[c(1:5, 11:15),])
bamDirname(v) <- getwd()
v