When I ran GATK HaplotypeCaller, GATK complained that my bam file was missing read group (RG) tag. How do I fix my bam file?
You can use the AddOrReplaceReadGroups function from GATK to add the RG tags (https://broadinstitute.github.io/picard/command-line-overview.html#AddOrReplaceReadGroups).
java -jar picard.jar AddOrReplaceReadGroups \ I=input.bam \ O=output.bam \ RGID=4 \ RGLB=lib1 \ RGPL=illumina \ RGPU=unit1 \ RGSM=20
If you do not know what to put in the read group, you need to contact the person who performed the sequencing and ask them to give you this information.
Thanks, problem solved!