Skip to content

Commit

Permalink
perf: add another fast path to overlap detection
Browse files Browse the repository at this point in the history
  • Loading branch information
clintval committed Sep 27, 2021
1 parent 4eaee5e commit 39fee88
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main/scala/com/fulcrumgenomics/bam/api/SamRecord.scala
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ trait SamRecord {
@inline final def matesOverlap: Option[Boolean] = {
require(mapped && paired && mateMapped, "Cannot determine if mates overlap without paired mates that are both mapped.")
if (refIndex != mateRefIndex) Some(false)
else if (mateStart > end) Some(false)
else if (mateStart >= start && mateStart <= end) Some(true)
else mateEnd.map(mateEnd => CoordMath.overlaps(start, end, mateStart, mateEnd))
}
Expand Down

0 comments on commit 39fee88

Please sign in to comment.