Dear Biostars,
I have saw an issue, I just wanted to share it with you and get some help and information. The dataset that I am working on is paired-end. I did the alignment with BWA two times. At first I have aligned the forward and reverse reads together to the reference to make the BAM file. The other time, I made the BAM files of each forward and reverse reads separately and then merged the two BAM files together. Here is the issue. When I use the flagstat in samtools, it showed that the number of reads that mapped are different? (the number of the merged BAM file is greater with 0.01% less mapped than the other one). I mean which one is better to be chosen for further analysis?
here is the results of each command:
$ samtools flagstat NIST7035_aln.bam
**35212307** + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
**8351** + 0 supplementary
0 + 0 duplicates
**35211338** + 0 mapped (100.00% : N/A)
35203956 + 0 paired in sequencing
17601978 + 0 read1
17601978 + 0 read2
34985750 + 0 properly paired (99.38% : N/A)
35202544 + 0 with itself and mate mapped
443 + 0 singletons (0.00% : N/A)
27066 + 0 with mate mapped to a different chr
9808 + 0 with mate mapped to a different chr (mapQ>=5)
$ samtools flagstat NIST7035_aln_merged.bam
**37720572** + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
**8737** + 0 supplementary
0 + 0 duplicates
**37717463** + 0 mapped (99.99% : N/A)
35203956 + 0 paired in sequencing
17601978 + 0 read1
17601978 + 0 read2
34985750 + 0 properly paired (99.38% : N/A)
35202544 + 0 with itself and mate mapped
443 + 0 singletons (0.00% : N/A)
27066 + 0 with mate mapped to a different chr
9808 + 0 with mate mapped to a different chr (mapQ>=5)
This is the proper way to do the alignments with paired-end data.
This is not correct. There is spatial information in spacing of R1/R2 reads. Aligners take this into consideration when you align both files together.
Thank you very much for your help. Now, I guess I have gained the answer I was seeking.
I wrote the code below in SAMtools for merging the BAM files: