# NOT RUN {
bam <- system.file("extdata", "accepted_hits.bam", package="rbamtools")
idx <- system.file("extdata", "accepted_hits.bam.bai", package="rbamtools")
#
reader<-bamReader(bam)
isOpen(reader)
#
align<-getNextAlign(reader)
#
loadIndex(reader,idx)
indexInitialized(reader)
#
coords<-as.integer(c(0,0,249250621))
range<-bamRange(reader,coords)
align<-getNextAlign(range)
#
bamClose(reader)
# }
Run the code above in your browser using DataLab