From 8983de792257565b841668c3f7e11cb699d837e8 Mon Sep 17 00:00:00 2001 From: Joe Vieira Date: Mon, 14 Nov 2022 17:48:18 -0500 Subject: [PATCH] Output new BedPE entry once per "either" hit. --- src/pairToBed/pairToBed.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/pairToBed/pairToBed.cpp b/src/pairToBed/pairToBed.cpp index 0c360bb9f..81ee56a8a 100644 --- a/src/pairToBed/pairToBed.cpp +++ b/src/pairToBed/pairToBed.cpp @@ -97,14 +97,7 @@ void BedIntersectPE::FindOverlaps(const BEDPE &a, vector &hits1, vector= _overlapFraction ) { numOverlapsEnd1++; - - if (type == "either") { - _bedA->reportBedPETab(a); - _bedB->reportBedNewLine(*h); - } - else { - qualityHits1.push_back(*h); - } + qualityHits1.push_back(*h); } } } @@ -128,20 +121,18 @@ void BedIntersectPE::FindOverlaps(const BEDPE &a, vector &hits1, vector= _overlapFraction ) { numOverlapsEnd2++; - - if (type == "either") { - _bedA->reportBedPETab(a); - _bedB->reportBedNewLine(*h); - } - else { - qualityHits2.push_back(*h); - } + qualityHits2.push_back(*h); } } } // Now report the hits depending on what the user has requested. - if (type == "neither") { + if (type == "either") { + if ( (numOverlapsEnd1 > 0) || (numOverlapsEnd2 > 0) ) { + _bedA->reportBedPENewLine(a); + } + } + else if (type == "neither") { if ( (numOverlapsEnd1 == 0) && (numOverlapsEnd2 == 0) ) { _bedA->reportBedPENewLine(a); } @@ -189,6 +180,7 @@ void BedIntersectPE::FindOverlaps(const BEDPE &a, vector &hits1, vector