# NOT RUN {
bam <- system.file("extdata", "accepted_hits.bam", package="rbamtools")
reader <- bamReader(bam)
# }
# NOT RUN {
readerToFastq(reader, "out.fq.gz")
# }
# NOT RUN {
bamClose(reader)
# Reopen in order to point to first align
reader <- bamReader(bam)
index <- sample(1:100, 20)
# }
# NOT RUN {
readerToFastq(reader, "out_subset.fq.gz", which=index)
# }
Run the code above in your browser using DataLab