# NOT RUN {
bam<-system.file("extdata","accepted_hits.bam",package="rbamtools")
reader<-bamReader(bam,idx=TRUE)
# Extract data for HLHL17 gene:
seqid<-"chr1"
start<-895967
end<-901099
gene_name<-"HLHL17" # (optional)
ranges<-data.frame(seqid=seqid,start=start,end=end,gene_name=gene_name)
# }
# NOT RUN {
extractRanges(reader,ranges=ranges,filename="new_file.bam")
# }
Run the code above in your browser using DataLab