From dcaa891581461cfb15431b9d1c27ca2ebdfee35e Mon Sep 17 00:00:00 2001 From: tfenne Date: Wed, 18 Oct 2023 14:51:38 -0600 Subject: [PATCH] Ensure that query range used is limited to contig start/stop. --- .../com/fulcrumgenomics/sv/tools/AggregateSvPileup.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/scala/com/fulcrumgenomics/sv/tools/AggregateSvPileup.scala b/src/main/scala/com/fulcrumgenomics/sv/tools/AggregateSvPileup.scala index ce0d61f..df1af6c 100644 --- a/src/main/scala/com/fulcrumgenomics/sv/tools/AggregateSvPileup.scala +++ b/src/main/scala/com/fulcrumgenomics/sv/tools/AggregateSvPileup.scala @@ -351,8 +351,8 @@ case class AggregatedBreakpointPileup(id: String, source = src, contig = contig, breakends = pileups, - queryMin = minPos - flank, - queryMax = maxPos + flank, + queryMin = Math.max(1, minPos - flank), + queryMax = Math.min(maxPos + flank, src.dict(contig).length), minTotal = minTotal, minFrequency = minFrequency, ) @@ -461,7 +461,6 @@ case class AggregatedBreakpointPileup(id: String, private def overlapsTarget(contig: String, start: Int, end: Int, targets: OverlapDetector[BEDFeature]): Boolean = { targets.overlapsAny(new Interval(contig, start, end)) } - }