Samtools flagstat
1
0
Entering edit mode
2.3 years ago
rakszewska • 0

I aligned my ONT sequencing run with minimap2, subsequently I filtered the file using samtools view -b -F 256 aln_transcriptome_sorted_6.bam -o filtered_aln_transcriptome_6.bam to end up with primary alignments only. When I run samtools flagstat on the filtered file I get the following output:

3502608 + 0 in total (QC-passed reads + QC-failed reads)
3186175 + 0 primary
0 + 0 secondary
316433 + 0 supplementary
0 + 0 duplicates
0 + 0 primary duplicates
3502608 + 0 mapped (100.00% : N/A)
3186175 + 0 primary mapped (100.00% : N/A)
0 + 0 paired in sequencing
0 + 0 read1
0 + 0 read2
0 + 0 properly paired (N/A : N/A)
0 + 0 with itself and mate mapped
0 + 0 singletons (N/A : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)

What is the difference between mapped and primary mapped statistics? And why do I still seem to have non primary alignments in my file after filtering?

samtools minimap2 • 1.2k views
ADD COMMENT
5
Entering edit mode
2.3 years ago

The sam specification is pretty confusing and awkward to use - making interpretation of the results needlessly complicated (as your example demonstrates).

There is no flag for directly selecting the primary alignments - instead you need to remove the SECONDARY, the SUPPLEMENTARY, and the UNMAPPED alignments to be left with the so-called primary alignments.

It is best written out explicitly like so:

samtools flags -F 256 -F 2048 -F 4
ADD COMMENT

Login before adding your answer.

Traffic: 1512 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