This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Samtools flagstat result

Hello there,

thanks for your time.

I'm confused in matching flagstat result total counts and number of reads counts in my fastq file.

My fastq file has, 8,22,6,69,352 reads but when i run "flagstat" on aligned Bam file which took same fastq file reads to align. below is the result. why is there so much difference in total number of reads. how flagstat is counting the reads.

Reads are aligned with Dragen, Bowtie-2 & BWA. only Bowtie2 is showing same total counts, below is the Dragen aligned reads count from flagstat.

flagstat result for Dragen:

853282571 + 0 in total (QC-passed reads + QC-failed reads)        
0 + 0 secondary   
30811231 + 0 supplementary   
54258734 + 0 duplicates  
852238970 + 0 mapped (99.88% : N/A)  
822471340 + 0 paired in sequencing  
411235670 + 0 read1  
411235670 + 0 read2  
796888884 + 0 properly paired (96.89% : N/A)  
820510718 + 0 with itself and mate mapped   
917021 + 0 singletons (0.11% : N/A)   
16464336 + 0 with mate mapped to a different chr   
10496086 + 0 with mate mapped to a different chr (mapQ>=5)

Could you please have a look and share anything which helps me in understanding the meaning behind different counts for same file.

Thanks once again,

best regards,
kiran.

samtools flagstat

Just wanted to add one more doubt, how is QC-pass or QC-fail is happening, i mean based on what factors is failing or passing a reads. like ( Read length, Read base quality, Duplicate reads)

853282571 + 0 in total (QC-passed reads + QC-failed reads)  - ------- What is QC process ( how read is getting passed or failed )  
0 + 0 secondary  
30811231 + 0 supplementary  
54258734 + 0 duplicates  
852238970 + 0 mapped (99.88% : N/A)  
822471340 + 0 paired in sequencing  
411235670 + 0 read1  
411235670 + 0 read2  
796888884 + 0 properly paired (96.89% : N/A)  
820510718 + 0 with itself and mate mapped  
917021 + 0 singletons (0.11% : N/A)  
16464336 + 0 with mate mapped to a different chr  
10496086 + 0 with mate mapped to a different chr (mapQ>=5)

1 answer

You need to read the SAM specification: http://samtools.github.io/hts-specs/

It will explain the meaning of things like supplementary and secondary, which need to be understood. Samtools flagstat is simply giving you a break down of the frequency of FLAG bits defined in that specification. Here the answer is simply that you have supplementary alignments (aka chimeric alignments, where a single read is broken into multiple fragments each producing its own alignment line), which boosts the total number of alignment records.

Likewise QC meaning isn't defined by samtools. It's not even strictly defined by the SAM specification either, but is left up to the aligner to define what they mean by QC pass and QC fail. You'll need to read the aligner documentation.

PS. What's going on with commas in "8,22,6,69,352"? Please none at all or in trios (thousands, millions, billions, etc).

Log in to answer this question.