| coverage-methods {GenomicAlignments} | R Documentation |
coverage methods for GAlignments,
GAlignmentPairs, and BamFile objects.
NOTE: The coverage generic function and methods
for Ranges and RangesList objects
are defined and documented in the IRanges package.
Methods for GRanges and
GRangesList objects are defined and
documented in the GenomicRanges package.
## S4 method for signature 'GAlignments'
coverage(x, shift=0L, width=NULL, weight=1L,
method=c("auto", "sort", "hash"), drop.D.ranges=FALSE)
## S4 method for signature 'GAlignmentPairs'
coverage(x, shift=0L, width=NULL, weight=1L,
method=c("auto", "sort", "hash"), drop.D.ranges=FALSE)
## S4 method for signature 'BamFile'
coverage(x, shift=0L, width=NULL, weight=1L, ...,
param=ScanBamParam())
## S4 method for signature 'character'
coverage(x, shift=0L, width=NULL, weight=1L, ...,
yieldSize=2500000L)
x |
A GAlignments, GAlignmentPairs, BamFile
or |
shift, width, weight |
See |
method |
See |
drop.D.ranges |
Whether the coverage calculation should ignore ranges corresponding to D (deletion) in the CIGAR string. |
... |
Additional arguments passed to the |
param |
An optional ScanBamParam object passed to
|
yieldSize |
An optional argument controlling how many records are input when iterating through a BamFile. |
The methods for GAlignments and GAlignmentPairs objects do:
coverage(grglist(x), ...)
The method for BamFile objects iterates through a
BAM file, reading yieldSize(x) records (or all records, if
is.na(yieldSize(x))) and calculating:
aln <- readGAlignments(x, param=param) coverage(aln, shift=shift, width=width, weight=weight, ...)
The method for character vectors of length 1 creates a
BamFile object from x and performs the
calculation for coverage,BamFile-method.
A named RleList object with one coverage vector per
seqlevel in x.
coverage in the IRanges package.
coverage-methods in the GenomicRanges package.
RleList objects in the IRanges package.
GAlignments and GAlignmentPairs objects.
ex1_file <- system.file("extdata", "ex1.bam", package="Rsamtools")
gal <- readGAlignments(ex1_file)
stopifnot(identical(coverage(gal), coverage(as(gal, "GRangesList"))))
galp <- readGAlignmentPairs(ex1_file)
stopifnot(identical(coverage(galp), coverage(as(galp, "GRangesList"))))