I have `samtools flagstat` for my FASTQ file as be...
# oncoanalyser
ö
I have
samtools flagstat
for my FASTQ file as below (only R1, same numbers for R2 as well):
Copy code
27029628 + 0 in total (QC-passed reads + QC-failed reads)
27029628 + 0 primary
0 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
0 + 0 primary duplicates
0 + 0 mapped (0.00% : N/A)
0 + 0 primary mapped (0.00% : N/A)
27029628 + 0 paired in sequencing
27029628 + 0 read1
0 + 0 read2
0 + 0 properly paired (0.00% : N/A)
0 + 0 with itself and mate mapped
0 + 0 singletons (0.00% : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
After processing with
oncoanalyser
, I have the
samtools flagstat
for redux BAM files as below:
Copy code
59520069 + 0 in total (QC-passed reads + QC-failed reads)
59501038 + 0 primary
0 + 0 secondary
19031 + 0 supplementary
11655993 + 0 duplicates
11653556 + 0 primary duplicates
59461559 + 0 mapped (99.90% : N/A)
59442528 + 0 primary mapped (99.90% : N/A)
59501038 + 0 paired in sequencing
29750519 + 0 read1
29750519 + 0 read2
59155516 + 0 properly paired (99.42% : N/A)
59437080 + 0 with itself and mate mapped
5448 + 0 singletons (0.01% : N/A)
247516 + 0 with mate mapped to a different chr
229968 + 0 with mate mapped to a different chr (mapQ>=5)
I am wondering how the number of reads increased after the alignment, i.e. went from 27M to 29.7M.
r
Hi Ömer, is this a single lane (with 2 rows) vs a single redux bam (post alignment of that sample) or some other type of comparison?
ö
Yes single lane.
s
Hi @Ömer An, the difference in read counts here results from consensus read formation in REDUX for duplicate reads
This involves the original reads / alignments being marked as duplicates and a new consensus read / alignment being added, hence the increase in read counts
Here is a worked example showing explainable counts for simulated wgs data across various inputs / outputs of oncoanalyser:
Copy code
# Input reads
$ samtools flagstat data/sample_data/fastq.modified/subject_a.tumor.dna.modified.R1.fastq.gz | grep -e total -e read1
210146 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 read1

# bwa-mem2 BAM
$ samtools flagstat $(find work/ -type f -name '*tumor*bam' ! -name '*redux*') | grep -e total -e read1
420311 + 0 in total (QC-passed reads + QC-failed reads)
210146 + 0 read1

# REDUX BAM
$ samtools flagstat output/subject_a/alignments/dna/subject_a.tumor.redux.bam | grep -e total -e read1
422353 + 0 in total (QC-passed reads + QC-failed reads)
211167 + 0 read1

# Forward read alignments (excluding secondary, supplementary, and consensus); consensus reads identified by 'CNS_' string
$ samtools view -f READ1 -F SECONDARY,SUPPLEMENTARY output/subject_a/alignments/dna/subject_a.tumor.redux.bam | grep -v CNS | wc -l
210146
ö
Thanks for the explanation @Stephen Watts, not it’s clear where they come from. However now the question is how these extra consensus reads are affecting the downstream analysis? For example, when picard CollectHsMetrics is run, is the bait/target coverage elevated due to the consensus reads?
*now it's clear
s
I’m not familiar with how CollectHsMetrics works and I don’t have appropriate data to check the behaviour
I would hope that the tool does not include marked duplicates in the coverage figures, and assuming this is the case then I would not expect inflation of these statistics following REDUX processing / forming consensus reads as described
If you’d like to test this assumption on your data, you could pull the plain bwa-mem2 BAM from the work directory of an analysis then run the CollectHsMetrics tool on both this BAM and the REDUX BAM to compare reported coverage
ö
Actually it does in the (PF_READS), that’s how I discovered this issue, although there is another field for unique reads (PF_UNIQUE_READS). However, my concern is not counting the marked duplicates in the stats, which is good to know the number of duplicates before and after deduplication. My concern is overcounting them, i.e. the marked duplicates are counted and consensus reads are also counted, leading to a higher number of reads than in the original FASTQ if the flags are not considered.
That’s a good suggestion and I will do it and let you know how they compare.