Hi all,
I have a whole genome mammalian sample that was sequenced on 2 lanes of Illumina Hiseq.
I have aligned the paired fastq with BWA mem and sorted with SAMtools.
I merged the 2 BAM files with SAMtools but attempting to run GATK RealignerTargetCreator threw the following error:
" SAM/BAM file SAMFileReader{/project/RDS-FVS-Cribbing-RW/FM2001_Out/FM2001_rmdup.bam} is malformed: Read HWI-ST1206:76
0WV0ACXX:1:2212:18877:61235 uses a read group (D0WV0ACXX) that is not defined in the BAM header, which is not valid."
I then realised that SAMtools takes only the RG header from the first BAM in the list, so I tried to instead use Picard's MergeSamFiles. This gives me the following error, but I do have unique RG headers for the 2 BAMs I am attempting to merge:
"Exception in thread "main" htsjdk.samtools.SAMFormatException: SAM validation error: ERROR: Record 1, Read name HWI-ST1206:79
10WJACXX:5:1307:3604:24593, RG ID on SAMRecord not found in header: D10WJACXX"
Here are the RG and PG headers of the two BAMs:
@RG ID
10WJACXX PL:illumina PU
10WJACXX LB:FM_FM2001_1 SM:FM_FM2001 CN:UniversityOfBern
@PG ID:bwa PN:bwa VN:0.7.12-r1039 CL:/usr/local/bwa/0.7.12/bwa mem -t 12 -R @RG rgID
10WJACXX PL:illumina PU
10WJACXX LB:FM_FM2001_1 SM:FM_FM2001 CN:UniversityOfBern /project/RDS-FVS-Cribbing-RW/equcab2.fasta /project/RDS-FVS-Cribbing-RW/FM2001/p-HORSE_D10WJACXX_GGCTAC_FM2001_R1.fastq.gz /project/RDS-FVS-Cribbing-RW/FM2001/p-HORSE_D10WJACXX_GGCTAC_FM2001_R2.fastq.gz
@RG ID
0WV0ACXX PL:illumina PU
0WV0ACXX LB:FM_FM2001_1 SM:FM_FM2001 CN:UniversityOfBern
@PG ID:bwa PN:bwa VN:0.7.12-r1039 CL:/usr/local/bwa/0.7.12/bwa mem -t 12 -R @RG rgID
0WV0ACXX PL:illumina PU
0WV0ACXX LB:FM_FM2001_1 SM:FM_FM2001 CN:UniversityOfBern /project/RDS-FVS-Cribbing-RW/equcab2.fasta /project/RDS-FVS-Cribbing-RW/FM2001/p-HORSE_D0WV0ACXX_GGCTAC_FM2001_R1.fastq.gz /project/RDS-FVS-Cribbing-RW/FM2001/p-HORSE_D0WV0ACXX_GGCTAC_FM2001_R2.fastq.gz
(Note: I have performed a reheader on these BAMs following a bug and a solution described at this page http://gatkforums.broadinstitute.org...and-gatk-error)
The RG tags of the reads do match the RG headers, here is one read from each BAM:
HWI-ST1206:79
10WJACXX:1:1101:1120:2193 99 18 74721856 60 101M = 74721945 190 TATCTGATGATTTTTATAAGCTATAAATTCAAGGAGGGATTGGCTAGGAGATTGTTCTGCTCCATAATGGCGTTGACTAGACGGCCATTTGATGGTATTCA CCCFFFFFHHHHHFIIIJJJJJIJJJJJIJJJJJHIFIGGHEIIIJIJJJIHHJHIIJFIJJGHGIJIEIIGBHDEBEEDCEABDDBDCDDEDCC>CCCCD NM:i:0 MD:Z:101 AS:i:101 XS:i:0 RG:Z
10WJACXX
HWI-ST1206:76
0WV0ACXX:1:1101:1161:2233 121 19 757702 60 101M = 757702 0 GAATTCTGTAGTCTTTTTGACTGGAAGACTAGACGGCAGAGATCAAGGCATCTCCCGCCTCTAAGAATTGAGAGGATATCCCAGAAAAGAGGATATCCCAG ###################################################B:;@GB9FCGG9IIIFCGHBIIHBIIHECH@EGE<@GHFHHBDDBB1;?; NM:i:4 MD:Z:3A18T10A16G50 AS:i:82 XS:i:20 RG:Z
0WV0ACXX
I have tried without editing the headers from RG to rgID, and get the error described on the link listed above.
I have tried enclosing the RG header within the PG header in single tick marks and also get an error.
I have tried filling the ID value as '1' for each of the BAMs instead of the flow cell id. Still throws an error.
The error from Picard's MergeSamFiles states"...is not defined in the BAM header, which is not valid" --> I don't see what is invalid about my RG headers?
I have used this same RG header type in many alignments using the same pipeline, just with single BAMs per sample. GATK has never had a problem with my BAMs or RG headers before.
Any suggestions most welcome.
I have a whole genome mammalian sample that was sequenced on 2 lanes of Illumina Hiseq.
I have aligned the paired fastq with BWA mem and sorted with SAMtools.
I merged the 2 BAM files with SAMtools but attempting to run GATK RealignerTargetCreator threw the following error:
" SAM/BAM file SAMFileReader{/project/RDS-FVS-Cribbing-RW/FM2001_Out/FM2001_rmdup.bam} is malformed: Read HWI-ST1206:76

I then realised that SAMtools takes only the RG header from the first BAM in the list, so I tried to instead use Picard's MergeSamFiles. This gives me the following error, but I do have unique RG headers for the 2 BAMs I am attempting to merge:
"Exception in thread "main" htsjdk.samtools.SAMFormatException: SAM validation error: ERROR: Record 1, Read name HWI-ST1206:79

Here are the RG and PG headers of the two BAMs:
@RG ID


@PG ID:bwa PN:bwa VN:0.7.12-r1039 CL:/usr/local/bwa/0.7.12/bwa mem -t 12 -R @RG rgID


@RG ID


@PG ID:bwa PN:bwa VN:0.7.12-r1039 CL:/usr/local/bwa/0.7.12/bwa mem -t 12 -R @RG rgID


(Note: I have performed a reheader on these BAMs following a bug and a solution described at this page http://gatkforums.broadinstitute.org...and-gatk-error)
The RG tags of the reads do match the RG headers, here is one read from each BAM:
HWI-ST1206:79


HWI-ST1206:76


I have tried without editing the headers from RG to rgID, and get the error described on the link listed above.
I have tried enclosing the RG header within the PG header in single tick marks and also get an error.
I have tried filling the ID value as '1' for each of the BAMs instead of the flow cell id. Still throws an error.
The error from Picard's MergeSamFiles states"...is not defined in the BAM header, which is not valid" --> I don't see what is invalid about my RG headers?
I have used this same RG header type in many alignments using the same pipeline, just with single BAMs per sample. GATK has never had a problem with my BAMs or RG headers before.
Any suggestions most welcome.