How to properly combine two bam files of a paired-end data
Hi all!
I am mapping a paired-end read separately using bowtie2.
After that, I want to combine the two bam file into one for downstream analysis.
How to properly do this combination?
I tried:
samtools sort -n R1.bam R1.sorted
samtools sort -n R1.bam R1.sorted
samtools merge R1_R2.bam R1.sorted.bam R2.sorted.bam
But it seems not working. The header of the R1_R2.bam is like following:
603889264 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 duplicates
590620124 + 0 mapped (97.80%:-nan%)
0 + 0 paired in sequencing
0 + 0 read1
0 + 0 read2
0 + 0 properly paired (-nan%:-nan%)
0 + 0 with itself and mate mapped
0 + 0 singletons (-nan%:-nan%)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
Which shows that the alignment of R1 and R2 are no properly paired. Also there is no @RG header line in the combined file.
What might be the problem?
Thanks a lot!!!
• 6.0k views