Many thanks Pierre
I am having problems processing a BAM file with UnifiedGenotyper. It says at the beginning that "java.lang.Character cannot be cast to java.lang.String". I have run this to validate the format: java -jar ./picard-tools-2.1.1/picard.jar ValidateSamFile I=prueba2.bam MODE=SUMMARY
I get this error: Exception in thread "main" java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String at htsjdk.samtools.SAMRecord.isValid(SAMRecord.java:2000) at htsjdk.samtools.SAMRecord.isValid(SAMRecord.java:1854) at htsjdk.samtools.SamFileValidator.validateSamRecordsAndQualityFormat(SamFileValidator.java:274) at htsjdk.samtools.SamFileValidator.validateSamFile(SamFileValidator.java:200) at htsjdk.samtools.SamFileValidator.validateSamFileSummary(SamFileValidator.java:128) at picard.sam.ValidateSamFile.doWork(ValidateSamFile.java:187) at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:209) at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:95) at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:105)
Samtools is perfectly able to read it. The error seem to have arisen after rescaling base qualities according to DNA damage patterns (using mapDamage) because the BAM before is perfectly digested by GATK. Any hint on how can I fix this?
Many thanks Federico
2 answers
the problem is in the tool that generated your input bam:
RG:A:1
is wrong, it should be
RG:Z:1
the spec https://samtools.github.io/hts-specs/SAMv1.pdf says:
RG : Z : Read group. Value matches the header RG-ID tag if @RG is present in the header.
please validate this answer (icon on the left) so the questioncan be closed.
There is an issue with read groups (as others have pointed out already). Usually, any read group errors can be fixed with Picard AddOrReplaceReadGroups: http://broadinstitute.github.io/picard/command-line-overview.html#AddOrReplaceReadGroups
Thanks for the idea. Unfortunately, Picard was unable to digest the file.
Log in to answer this question.
The stacktrace shows that there is a problem with the read group RG: https://github.com/samtools/htsjdk/blob/master/src/java/htsjdk/samtools/SAMRecord.java#L2000
Can you please show us the RG line(s) in the sam header and one SAM line with that group please.
This is what I have in the header:
Then, for the mapped reads I have things like:
etc
Do you see a problem there? Thanks! Federico
Unless you have a good reason to do so, I would suggest to use Haplotypecaller. Unifiedgenotypecaller is outdated.
@decoserwouter he/she never said he/she was using Unifiedgenotypecaller