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)
Run the code above in your browser using DataLab