Is there any difference in the output files when you make BAM files of a paired-end file separately and then merged together? or just make a single BAM file from the start?
0
0
Entering edit mode
2.3 years ago
soheil • 0

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)
WES BAM • 957 views
ADD COMMENT
0
Entering edit mode

At first I have aligned the forward and reverse reads together to the reference to make the BAM fil

This is the proper way to do the alignments with paired-end data.

The other time, I made the BAM files of each forward and reverse reads separately and then merged the two BAM files together

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.

ADD REPLY
0
Entering edit mode

Thank you very much for your help. Now, I guess I have gained the answer I was seeking.

ADD REPLY
0
Entering edit mode

I wrote the code below in SAMtools for merging the BAM files:

samtools merge NIST7035_aln_merged.bam NIST7035_aln.bam NIST_aln_unpaired1.bam NIST_aln_unpaired2.bam
ADD REPLY

Login before adding your answer.

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