This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Rsamtool or Rbamtools function to view the number of reads between a range

what is Equivalent R function for the command line below?

samtools view yourBAMfile.bam chr1:567876-568100 | wc -l

How should I approach.

I got a GRanges object with seqnames, start and end. I would like to count the number of reads between each range in the GRange object in a BAM file in R

rna-seq rsamtools rbamtools r

1 answer

rbamtools directly provides a count function (bamCount), so just go with that.

Log in to answer this question.