Skip to content

Commit

Permalink
fix: cleanup error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
znorgaard committed Jul 24, 2024
1 parent e9b2dde commit 3d78b3a
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3d78b3a

Please sign in to comment.