MergeBamAlignment Error: ArrayIndexOutOfBoundsException
Using PicardTools 2.18.7
Command:
java -jar picard.jar MergeBamAlignment \
12 ALIGNED=mapped_RG.bam \
13 UNMAPPED=unmapped_RG.bam \
14 O=merged.bam \
15 R=human_ref_GRCh38_all.fa
Log:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 147 out of bounds for length 147
at htsjdk.samtools.util.SequenceUtil.calculateMdAndNmTags(SequenceUtil.java:959)
at picard.sam.AbstractAlignmentMerger.fixNmMdAndUq(AbstractAlignmentMerger.java:590)
at picard.sam.AbstractAlignmentMerger.mergeAlignment(AbstractAlignmentMerger.java:565)
at picard.sam.SamAlignmentMerger.mergeAlignment(SamAlignmentMerger.java:186)
at picard.sam.MergeBamAlignment.doWork(MergeBamAlignment.java:356)
at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:282)
at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:103)
at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:113)
Both BAM files have been validated using ValidateSamFile in summary mode, no warnings or errors.
Have tried OpenJDK 1.8.0_152 and OpenJDK Version "11" 2018-09-25, received the same error both times
-
Have also run with Oracle 1.8, same error
-
This is most likely an issue related to formatting or mismatches in read length between files.
In Java, the ArrayIndexOutOfBoundsException is usually outputted when an index is passed to an array that doesn’t contain an element at that particular index location. In other words, the code is trying to put something into a set when there is no room for it, and Java identifies that as being "out of bounds".
Please see this post for more information.
I don't know the specifics of your files, but it is possible that you have a mismatch in read lengths, possibly from when you trimmed them. Alternately, one of your mapped BAM files may be formatted differently than your unmapped BAM file.
You might want to run your files through ValidateSamFile beforehand.
-
My original BAM file had some messed up alignments in it. I made a new BAM file and solved the issue. Thank you
Please sign in to leave a comment.
3 comments