See the Glossary entry on read groups for more information about what they represent and why they're very important.
Errors about missing or undefined read groups
As detailed in the FAQs about input requirements, GATK expects all read groups appearing in the read data to be specified in the file header, and will fail with an error if it does not find that information (whether there is no read group information in the file, or a subset of reads do not have read groups).
Typically you should add read group information when you perform the original alignments (with e.g. BWA, which has an option to do so). So what do you do if you forgot to do that, and you don't want to have to rerun BWA all over again?
Solution
If your sample collection's BAM files lack required fields, or do not differentiate pertinent factors within the fields, use Picard's AddOrReplaceReadGroups to add or appropriately rename the read group fields in your input file.
Here's an example:
# throws an error gatk HaplotypeCaller \ -R reference.fasta \ -I reads_without_RG.bam \ -o output.vcf # fix the read groups java -jar picard.jar AddOrReplaceReadGroups \ I=reads_without_RG.bam \ O=reads_with_RG.bam \ SORT_ORDER=coordinate \ RGID=foo \ RGLB=bar \ RGPL=illumina \ RGSM=Sample1 \ CREATE_INDEX=True # runs without error gatk HaplotypeCaller \ -R reference.fasta \ -I reads_with_RG.bam \ -o output.vcf
Note that if you don't know what information to put in the read groups, you should ask whoever performed the sequencing or provided the BAM to give you the metadata you need.
3 comments
Thank you for this example of how to use AddOrReplaceReadGroups! Would a specified RGPU also be a required for this to run?
Thank you, while running it also asked for the RGPU as mandatory input.
Thank you. I sequenced in a MGI platform, so MGI is not a valid value for -RGPL when using AddOrReplaceReadGroups, what can I do to avoid this ERROR in HaplotypeCaller?
Please sign in to leave a comment.