| BamFile-methods {rtracklayer} | R Documentation |
Methods for import and export of
GappedAlignments objects from and to BAM
files, represented as BamFile objects.
## S4 method for signature 'BamFile,ANY,ANY'
import(con, format, text, use.names = FALSE,
param = ScanBamParam(...), ...)
## S4 method for signature 'ANY,BamFile,ANY'
export(object, con, format, ...)
object |
The object to export, should be
a |
con |
A path, URL, connection or |
format |
If not missing, should be “bam”. |
text |
Not supported. |
use.names |
Whether to parse QNAME as the names on the result. |
param |
The |
... |
Arguments that are passed to |
BAM fields not formally present in the GappedAlignments object
are extracted from the metadata columns, if present; otherwise, the
missing value, “"."”, is output. The file is sorted and
indexed. This can be useful for subsetting BAM files, although
filterBam may eventually become flexible
enough to be the favored alternative.
Michael Lawrence
readGappedAlignments for reading BAM
files into a GappedAlignments.
library(Rsamtools)
ex1_file <- system.file("extdata", "ex1.bam", package="Rsamtools")
gal <- import(ex1_file, param=ScanBamParam(what="flag"))
gal.minus <- gal[strand(gal) == "-"]
## Not run:
export(gal, BamFile("ex1-minus.bam"))
## End(Not run)