# NOT RUN {
bam<-system.file("extdata","accepted_hits.bam",package="rbamtools")
reader<-bamReader(bam, idx=TRUE)
rg <- bamRange(reader, getRefCoords(reader,"chr1"))
# }
# NOT RUN {
writer <- bamWriter(bamReader, "out.BAM")
bamSave(writer, rg)
bamClose(writer)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab