Just to confirm, the number of lines in a BAM file give the info on the number of reads it has? Apologies, I am completely new to this area.
• 0 views
•
link
How can I get the number of mapped reads for a particular region?
samtools view -c -F 4 my.bam gives me count in the entire bam file but I can't just add -r Chr1:0:1000 to get reads in that region only.
samtools view in.bam chr1:0-1000 | wc -l
but better way is to do it with bedtools if you have many regions, for e.g like exon coordinates or peak coordinates, which is more efficient way for counting purpose.
bedtools multicov -bams aln1.bam [ aln2.bam aln3.bam . . ] -bed ivls-of-interest.bed
Just to confirm, the number of lines in a BAM file give the info on the number of reads it has? Apologies, I am completely new to this area.
Log in to answer this question.