I have a bam file which is missing read groups in the header.
Picard ValidateSamFile.jar gives : ERROR: Record 1, Read name M0VN6:402:2486, RG ID on SAMRecord not found in header: M0VN6 ...
So I try to use Picard AddOrReplaceReadGroups:
AddOrReplaceReadGroups.jar I= myBam.bam O= myBam.readGroupReplaced.bam SORT_ORDER=coordinate RGID=myBam RGLB=myBam RGPL=IONTORRENT RGSM=myBam RGPU=myBam
This gives the error:
ERROR: Record 1, Read name M0VN6:402:2486, RG ID on SAMRecord not found in header: M0VN6 ...
Why does Picard AddOrReplaceReadGroups crash about this? This is what I am trying to fix by using that function. Or do I misunderstand what AddOrReplaceReadGroups does?
What I get from the AddOrReplaceReadGroups discription is that it replaces all read groups in the Bam file with the one specified and assigns all reads to this read group.
You might want to have a look at the SAM format specifications