This is a test version of Biostars. For the public version, visit https://www.biostars.org.
GATK mutech2: Sample not found in BAM header

I get the following error when running mutech2, any idea what the reason is:

A USER ERROR has occurred: Bad input: Sample N-PANCNGS-006 is not in BAM header: []

gatk Mutect2 --native-pair-hmm-threads 30 -R  ~/genomes/BWA/Homo_sapiens.GRCh38.dna.primary_assembly.fa -I T-PANCNGS-006.bam -I N-PANCNGS-006.bam -normal N-PANCNGS-006 -O PANCNGS-006.vcf.gz

my bam header looks like this:

@SQ     SN:KI270394.1   LN:970
@PG     ID:bwa  PN:bwa  VN:0.7.17-r1188 CL:bwa mem -t 30   ~/genomes/BWA/Homo_sapiens.GRCh38.dna.primary_assembly N-PANCNGS-006_L001_R1_001.fastq.gz N-PANCNGS-006_L001_R2_001.fastq.gz
gatk

1 answer

For MuTect2, your bam files need to have sample names in the SM field in the header that starts with the @RG, and then passed the sample names onto --normal-sample and --tumor-sample arguments.

When you use BWA to align reads, you need to pass on the header like -R '@RG\tID:MY_ID\tLB:MY_LIBRARY\tPL:illumina\tSM:Tumor_Sample_Name'.

Then for Mutect, pass on --tumor-sample Tumor_Sample_Name and same for the normal. Make sure the tumor and normal samples have different sample names. You may in fact pass multiple bam files, and they'll all be treated as the tumor or normal data if the header SM tells them as such.

If you haven't created the @RG line at BWA, you can use picard AddOrReplaceReadGroups to add these things to the bam files.

Log in to answer this question.