# NOT RUN {
bam <- system.file("extdata", "accepted_hits.bam", package="rbamtools")
reader <- bamReader(bam, idx=TRUE)
coords <- as.integer(c(0, 0, 249250621))
range <- bamRange(reader, coords)
# }
# NOT RUN {
rangeToFastq(range, "range.fq.gz")
# }
# NOT RUN {
index <- sample(1:size(range), 100)
# }
# NOT RUN {
rangeToFastq(range, "range_subset.fq.gz", which=index)
# }
Run the code above in your browser using DataLab