Exclude reads with mate mapped to a different chr
Hi,
using samtools flagstat I have
14228966 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
0 + 0 supplementary
12102440 + 0 duplicates
14228966 + 0 mapped (100.00% : N/A)
14228966 + 0 paired in sequencing
7108585 + 0 read1
7120381 + 0 read2
14157300 + 0 properly paired (99.50% : N/A)
14199521 + 0 with itself and mate mapped
29445 + 0 singletons (0.21% : N/A)
1347 + 0 with mate mapped to a different chr
880 + 0 with mate mapped to a different chr (mapQ>=5)
I want to exclude all multimapping reads or at least the following reads
1347 + 0 with mate mapped to a different chr
880 + 0 with mate mapped to a different chr (mapQ>=5)
but I can not figure out what flags to use.
If I use -f 2 I lose around 70k reads
I do not know the mapping tool used for the reads alignment
Thanks
• 2,017 views
•
link
1 answer
For multimapping reads you can use the secondary or supplementary alignment flags. Alternately, if your aligner adds an additional tag (NH, for example) with the alignment count, you can use that for filtering. To drop alignments with mates mapped to different chromosomes, you can use filter expressions with samtools as follows:
samtools view -e 'rname==rnext' input.bam
• 0 views
•
link
Log in to answer this question.