diff --git a/src/main/scala/com/fulcrumgenomics/umi/CollectDuplexSeqMetrics.scala b/src/main/scala/com/fulcrumgenomics/umi/CollectDuplexSeqMetrics.scala index db90460b0..b5ee6c127 100644 --- a/src/main/scala/com/fulcrumgenomics/umi/CollectDuplexSeqMetrics.scala +++ b/src/main/scala/com/fulcrumgenomics/umi/CollectDuplexSeqMetrics.scala @@ -306,18 +306,19 @@ class CollectDuplexSeqMetrics override def execute(): Unit = { // Build the iterator we'll use based on whether or not we're restricting to a set of intervals val in = SamSource(input) - val _filteredIterator = in.iterator.filter(r => r.paired && r.mapped && r.mateMapped && r.firstOfPair && !r.secondary && !r.supplementary) + val _filteredIterator = in + .iterator + .filter(r => r.paired && r.mapped && r.mateMapped && r.firstOfPair && !r.secondary && !r.supplementary) .bufferBetter // Ensure the records are not consensus records _filteredIterator.headOption.foreach { - r => - def exceptionString = s"Input BAM file to CollectDuplexSeqMetrics ($input) appears to contain consensus reads." + + rec => + def exceptionString = s"Input BAM file to CollectDuplexSeqMetrics ($input) appears to contain consensus sequences. " + "CollectDuplexSeqMetrics cannot run on consensus BAMs, and instead requires the UMI-grouped BAM generated " + "prior to consensus calling. The UMI-grouped BAM is the output of running GroupReadsByUmi." + - s"\nFirst record in $input has consensus tags present:\n${_filteredIterator.head}" + s"\nFirst record in $input has consensus SAM tags present:\n$rec" - if (Umis.isConsensusRead(r)) throw new IllegalArgumentException(exceptionString) - else r + if (Umis.isConsensusRead(rec)) throw new IllegalArgumentException(exceptionString) } val iterator = intervals match { case None => _filteredIterator