Hi,
I started with R1 and R2 fastq files, and using a pipeline (https://github.com/ArimaGenomics/mapping_pipeline/blob/master/Arima_Mapping_UserGuide.pdf), I combined them to give a merged bam file (it also does other things like filtering for mapping quality, adding read groups and remove PCR duplicates).
Now, the files are from a HiC experiment, and I want to analyze them using HicPro, but HicPro cannot work with merged bam files, it needs separate bam files for R1 and R2. So, I wanted to know if there is a way to unmerge the merged bam file to the corresponding R1 and R2 bam files. Trying to search online I mostly found ways to convert the bam file back to fastq files (which I could do, and then again do fastq to bam, but that seems unintelligent).
Any help would be great. Suggestions for improvement are welcome.
use samtools view with flags first in pair or second in pair . see How To Know From Which File ( R1 Or R2 ) A Read Is Coming From Based On Sam Output