| BamSampler {Rsamtools} | R Documentation |
Use BamSampler() to create a reference to a BAM file (and
optionally its index). Calls to scanBam (and many functions
that use scanBam) draw a random sample from the BAM file.
## Constructors BamSampler(file, index = file, ..., yieldSize, obeyQname = FALSE, asMates = FALSE) ## S4 method for signature 'BamSampler' scanBam(file, index=file, ..., param=ScanBamParam(what=scanBamWhat()))
file |
character(1); BAM file path for |
index |
character(1); the BAM index file path (for
|
... |
Additional arguments; see |
yieldSize |
integer(1); number of records to yield each time the
file is read from using |
obeyQname |
logical(1); indicating whether the file is sorted by
|
asMates |
logical(1); indicating whether the records should be returned as mated pairs. |
param |
An optional |
Objects are created by calls of the form BamSampler().
The BamSampler class inherits fields from the
BamFile class.
BamSampler inherits methods from BamFile and can
be used in place of BamFile in many functions.
Martin Morgan
library(GenomicAlignments) # for readGAlignmentsFromBam()
fl <- system.file("extdata", "ex1.bam", package="Rsamtools")
samp <- BamSampler(fl, yieldSize=1000)
## two independent samples
head(readGAlignmentsFromBam(samp))
head(readGAlignmentsFromBam(samp))