picard: error reading BAM file
2
0
Entering edit mode
8.7 years ago
abascalfederico ★ 1.2k

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

bam htsjdk picard • 3.5k views
ADD COMMENT
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

This is what I have in the header:

@RG     ID:1    PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-5E363840   PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-3BE5F6C2   PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-295BE5CC   PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-122FA23D   PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-52D9FBD5   PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-4FFDBCC4   PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-76011FCC   PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-7A503F15   PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-489B658D   PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-2868CCF9   PL:illumina     PU:whatever     LB:whatever     SM:whatever
@RG     ID:1-20FFF29D   PL:illumina     PU:whatever     LB:whatever     SM:whatever

Then, for the mapped reads I have things like:

RG:Z:1-295BE5CC
RG:A:1
RG:Z:1-122FA23D
RG:Z:1-2868CCF9

etc

Do you see a problem there? Thanks! Federico

ADD REPLY
0
Entering edit mode

Unless you have a good reason to do so, I would suggest to use Haplotypecaller. Unifiedgenotypecaller is outdated.

ADD REPLY
0
Entering edit mode

@decoserwouter he/she never said he/she was using Unifiedgenotypecaller

ADD REPLY
3
Entering edit mode
8.7 years ago

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.

ADD COMMENT
0
Entering edit mode

Many thanks Pierre

ADD REPLY
0
Entering edit mode

please validate this answer (icon on the left) so the questioncan be closed.

ADD REPLY
0
Entering edit mode
8.7 years ago
igor 13k

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

ADD COMMENT
0
Entering edit mode

Thanks for the idea. Unfortunately, Picard was unable to digest the file.

ADD REPLY

Login before adding your answer.

Traffic: 2374 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6