I had to filter manually a sam file by keeping only reads that fall into a specific regions.
Using flagstat, my sam file is looking like this now:
160995 + 0 in total (QC-passed reads + QC-failed reads) 1148 + 0 secondary 0 + 0 supplementary 0 + 0 duplicates 159950 + 0 mapped (99.35% : N/A) 159847 + 0 paired in sequencing 79922 + 0 read1 79925 + 0 read2 142206 + 0 properly paired (88.96% : N/A) 157757 + 0 with itself and mate mapped 1045 + 0 singletons (0.65% : N/A) 10605 + 0 with mate mapped to a different chr 6694 + 0 with mate mapped to a different chr (mapQ>=5)
As you can see, there is not an even number of reads and the number of read1 is different of read2.
I would like to extract only paired reads (and make a new sam file) whenever they are mapped or unmapped.
I have tried using the flag -f 1 but it gaves the same result.
Anybody have solution ?
Thanks for your help.