I wanted to ask how MergeBamAlignment deals with conflicting header information. Specifically if the unmapped BAM and mapped BAM have different @RG tags in the header then how does it resolve? I do not see this in documentation.
My issue is that I add @RG tag information during alignment with BWA-MEM. But when I use mergebamalignment while the reads retain the @RG ID the header changes the @RGID to the unmapped BAM. Therefore the read group IDs of the actual reads is different than the header. I have three screen shots below of this.
I don't see any documentation of how to deal with conflicting headers - I know a workaround is to change the readgroups with AddOrReplace read groups after MergeBamAlignmnet but I would rather do this at the level of MergeBamAlignment
This question is similar but doesn't say how it resolves this conflict: https://gatk.broadinstitute.org/hc/en-us/community/posts/4406765311515-Read-group-info-in-mapped-and-unmapped-bam-files?input_string=MergeBamAlignment%20conflicting%20headers%20between%20mapped%20and%20unmapped
After merge bam alignment RG
BWA-MEM mapped RG
Unmapped read group
My version of GATK is 188.8.131.52
gatk MergeBamAlignment Aligned=sorted_mapped_group"$read_batch_num".bam UNMAPPED=sorted_unmapped_group"$read_batch_num".bam o=bam_aligned_"$read_batch_num".bam R=~/evronylab/reference-files/hg38-gatk/Homo_sapiens_assembly38.fasta
Please sign in to leave a comment.