diff --git a/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java b/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java index c1b03d002..4707a5060 100755 --- a/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java +++ b/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java @@ -327,9 +327,14 @@ public class GenomeAnalysisEngine { rg_sets.add(groups); for ( SAMReadGroupRecord g : r.getFileHeader().getReadGroups() ) { - // use HeaderMerger to translate original read group id from the reader into the read group id in the - // merged stream, and save that remapped read group id to associate it with specific reader - groups.add( hm.getReadGroupId(r, g.getReadGroupId()) ); + if (hm.hasGroupIdDuplicates()) { // Check if there were read group clashes with hasGroupIdDuplicates and if so: + // use HeaderMerger to translate original read group id from the reader into the read group id in the + // merged stream, and save that remapped read group id to associate it with specific reader + groups.add( hm.getReadGroupId(r, g.getReadGroupId()) ); + }else{ + // otherwise, pass through the unmapped read groups since this is what Picard does as well + groups.add( g.getReadGroupId() ); + } } }