Hello,
I have been working with samtools and I want to get a count of how many properly paired and mapped reads are within a region. I had been doing this previously:
When I run samtools flagstat I get the following result
261533415 + 0 in total (QC-passed reads + QC-failed reads)
81513623 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
236213573 + 0 mapped (90.32% : N/A)
180019792 + 0 paired in sequencing
90009896 + 0 read1
90009896 + 0 read2
154569772 + 0 properly paired (85.86% : N/A)
154569772 + 0 with itself and mate mapped
130178 + 0 singletons (0.07% : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
I want to know how many of the paired in sequencing
reads are within a region of a bed file.
I have been doing this with samtools view -L ${my_bed} -c -F 1028 ${bam}
but when I run that I get more reads than paired in sequencing, i.e: 181377346
Could someone tell me the exact flagged codes to use to get the paired in sequencing
reads?
-c just outputs the count, But if i can pipe samtools outputs directly to flagstat that might be more valuable.
I will try
samtools view -L ${my_bed} -b ${bam} | samtools flagstat -
That worked beautifully, thank you very much ATpoint