In order to use MergeBamAlignment (Picard), I need an unmapped BAM file and a mapped BAM file. I have two mapped BAM files:
- one with reads mapped to the reference I want but without metadata such as read group
- a second one with reads mapped to the incorrect reference but with metadata
When I try to use MergeBamAlignment with these two files, I get errors, such as "Second read from pair not found in unmapped bam". So I am trying to unmap the reads from my second BAM file. How can I do that? Is there a tool for it? Otherwise, I'll have to manually change the bitwise FLAGs, reference names, CIGARS, etc.