Exclude reads with mate mapped to a different chr
1
0
Entering edit mode
3.1 years ago
emma.a ▴ 130

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

samtools • 1.4k views
ADD COMMENT
1
Entering edit mode
3.1 years ago
vkkodali_ncbi ★ 3.8k

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
ADD COMMENT

Login before adding your answer.

Traffic: 1759 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6