Does anyone know how to calculate total number of mapped reads for a certain region of a bam file using samtools flagstat?
I know to use flagstat for the whole bam file. but for a specific region of it... is there an option?
Tnx
---------- Post updated at 12:27 PM ---------- Previous update was at 05:50 AM ----------
Oh I just realized that the tool was "samtools view" which is able to calculate the mapped reads of a certain region of a given bam file.
But I don't know how to do it yet; and which options should I use.
Mapped files are read by VM page faults, so at least one per page. I suppose an aggressive OS might map ahead or in larger blocks to assist fastest sequential access at the cost of some extra VM churn. For instance, to optimize large SAN blocks and RAIS striped access, it might read 65K starting with the page of the next byte, or based at the modulo 65K address of that byte, into newly mapped pages. This exploits buffers and caching on the SAN and disk drives, as wells as being RAID tolerant by writing whole striped blocks across N drives.