From f2209cfc537b21e36eede33247c293cfb16dc3ad Mon Sep 17 00:00:00 2001 From: Aaron <aaronquinlan@gmail.com> Date: Tue, 22 Mar 2011 08:50:26 -0400 Subject: [PATCH] Unmapped BAM alignments are now captured by -v in intersectBed and windowBed. Thanks to Davide Cittaro. --- src/intersectBed/intersectBed.cpp | 8 ++++++++ src/windowBed/windowBed.cpp | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/intersectBed/intersectBed.cpp b/src/intersectBed/intersectBed.cpp index d6ec2c28..53222ebc 100644 --- a/src/intersectBed/intersectBed.cpp +++ b/src/intersectBed/intersectBed.cpp @@ -278,6 +278,10 @@ void BedIntersect::IntersectBam(string bamFile) { bool overlapsFound = false; // treat the BAM alignment as a single "block" if (_obeySplits == false) { + // Toying with adding tags. Need new version of FindOverlaps. + // FindOverlaps(a, hits); + // bam.AddTag("YB", "i", static_cast<int>(hits.size())); + // hits.clear(); overlapsFound = FindOneOrMoreOverlap(a); } // split the BAM alignment into discrete blocks and @@ -327,6 +331,10 @@ void BedIntersect::IntersectBam(string bamFile) { } } } + // BAM IsMapped() is false + else if (_noHit == true) { + writer.SaveAlignment(bam); + } } // close the relevant BAM files. diff --git a/src/windowBed/windowBed.cpp b/src/windowBed/windowBed.cpp index 6b033612..b961f02c 100644 --- a/src/windowBed/windowBed.cpp +++ b/src/windowBed/windowBed.cpp @@ -204,6 +204,10 @@ void BedWindow::WindowIntersectBam(string bamFile) { hits.clear(); } } + // BAM IsMapped() is false + else if (_noHit == true) { + writer.SaveAlignment(bam); + } } // close the relevant BAM files. -- GitLab