Holiday Notice:
The Frontline Support team will be offline February 18 for President's Day but will be back February 19th. Thank you for your patience as we get to all of your questions!

MergeBamAlignment Fails, can use AddOrReplaceReadGroups to debug?

concon PennsylvaniaMember


I've been running a drop-seq experiment, and the 2nd to last command fails:

java -Xmx4000m -jar 3rdParty/picard/picard.jar MergeBamAlignment REFERENCE_SEQUENCE=mm10/mm10.fasta UNMAPPED_BAM=unaligned_mc_tagged_polyA_filtered.bam ALIGNED_BAM=aligned.sorted.bam INCLUDE_SECONDARY_ALIGNMENTS=false PAIRED_RUN=false OUTPUT=merged.bam

which generates this not-so-helpful error message

Exception in thread "main" java.lang.NullPointerException
at picard.sam.AbstractAlignmentMerger.createNewCigarIfMapsOffEndOfReference(
at picard.sam.AbstractAlignmentMerger.createNewCigarsIfMapsOffEndOfReference(
at picard.sam.AbstractAlignmentMerger.updateCigarForTrimmedOrClippedBases(
at picard.sam.AbstractAlignmentMerger.transferAlignmentInfoToFragment(
at picard.sam.AbstractAlignmentMerger.mergeAlignment(
at picard.sam.SamAlignmentMerger.mergeAlignment(
at picard.sam.MergeBamAlignment.doWork(
at picard.cmdline.CommandLineProgram.instanceMain(
at picard.cmdline.PicardCommandLine.instanceMain(
at picard.cmdline.PicardCommandLine.main(

which I thought that I had solved on but I didn't

This command requires two files, which I've examined with Picard's validateSamFile

for unaligned_mc_tagged_polyA_filtered.bam the error is

## HISTOGRAM    java.lang.String
Error Type    Count

and for aligned.sorted.bam, the error message is:

## HISTOGRAM    java.lang.String
Error Type    Count

which I think can be fixed by Picard's AddOrReplaceReadGroups (, but this command requires several options, which I don't know (the default options didn't work), i.e.

  RGID=4 \
  RGLB=lib1 \
  RGPL=illumina \
  RGPU=unit1 \

Illumina is obvious, but I don't know what to put for these options for a DropSeq experiment. How I can find these values for Picard's AddOrReplaceReadGroups?


  • shleeshlee CambridgeMember, Broadie, Moderator admin

    Hi again @con,

    For a description of read group fields and their implications for GATK tools, see this document and its discussion thread. You only need to add read groups to your unaligned BAM. MergeBamAlignment will apply the read group information from the unaligned BAM to the merged output.

Sign In or Register to comment.