Question: picard: error reading BAM file
0
gravatar for abascalfederico
2.9 years ago by
abascalfederico1.0k
Spain
abascalfederico1.0k wrote:

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 picard htsjdk • 1.5k views
ADD COMMENTlink modified 2.9 years ago by igor7.3k • written 2.9 years ago by abascalfederico1.0k
1

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 REPLYlink written 2.9 years ago by Pierre Lindenbaum116k

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 REPLYlink modified 2.9 years ago • written 2.9 years ago by abascalfederico1.0k

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

ADD REPLYlink written 2.9 years ago by WouterDeCoster36k

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

ADD REPLYlink written 2.9 years ago by Pierre Lindenbaum116k
3
gravatar for Pierre Lindenbaum
2.9 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum116k wrote:

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 COMMENTlink modified 2.9 years ago • written 2.9 years ago by Pierre Lindenbaum116k

Many thanks Pierre

ADD REPLYlink written 2.9 years ago by abascalfederico1.0k

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

ADD REPLYlink written 2.9 years ago by Pierre Lindenbaum116k
0
gravatar for igor
2.9 years ago by
igor7.3k
United States
igor7.3k wrote:

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 COMMENTlink written 2.9 years ago by igor7.3k

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

ADD REPLYlink written 2.9 years ago by abascalfederico1.0k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1615 users visited in the last hour