Skip to content
Snippets Groups Projects
Commit e818f468 authored by Aaron's avatar Aaron
Browse files

Fixed major bug in intersectBed -split. Thanks to Sol Katzman.

parent 2e3c8f96
No related branches found
No related tags found
No related merge requests found
...@@ -173,7 +173,7 @@ void BedIntersect::ReportOverlapSummary(const BED &a, const int &numOverlapsFoun ...@@ -173,7 +173,7 @@ void BedIntersect::ReportOverlapSummary(const BED &a, const int &numOverlapsFoun
bool BedIntersect::FindOneOrMoreOverlap(const BED &a) { bool BedIntersect::FindOneOrMoreOverlap(const BED &a) {
bool overlapsFound; bool overlapsFound = false;
if (_reciprocal == false) { if (_reciprocal == false) {
overlapsFound = _bedB->FindOneOrMoreOverlapsPerBin(a.chrom, a.start, a.end, a.strand, overlapsFound = _bedB->FindOneOrMoreOverlapsPerBin(a.chrom, a.start, a.end, a.strand,
_sameStrand, _diffStrand, _overlapFraction); _sameStrand, _diffStrand, _overlapFraction);
...@@ -245,11 +245,13 @@ void BedIntersect::IntersectBam(string bamFile) { ...@@ -245,11 +245,13 @@ void BedIntersect::IntersectBam(string bamFile) {
// load the "B" bed file into a map so // load the "B" bed file into a map so
// that we can easily compare "A" to it for overlaps // that we can easily compare "A" to it for overlaps
_bedB = new BedFile(_bedBFile);
_bedB->loadBedFileIntoMap(); _bedB->loadBedFileIntoMap();
// open the BAM file // open the BAM file
BamReader reader; BamReader reader;
BamWriter writer; BamWriter writer;
reader.Open(bamFile); reader.Open(bamFile);
// get header & reference information // get header & reference information
...@@ -270,8 +272,10 @@ void BedIntersect::IntersectBam(string bamFile) { ...@@ -270,8 +272,10 @@ void BedIntersect::IntersectBam(string bamFile) {
// reserve some space // reserve some space
hits.reserve(100); hits.reserve(100);
_bedA->bedType = 6; //_bedA->bedType = 6;
BamAlignment bam; BamAlignment bam;
// get each set of alignments for each pair. // get each set of alignments for each pair.
while (reader.GetNextAlignment(bam)) { while (reader.GetNextAlignment(bam)) {
...@@ -312,7 +316,7 @@ void BedIntersect::IntersectBam(string bamFile) { ...@@ -312,7 +316,7 @@ void BedIntersect::IntersectBam(string bamFile) {
vector<BED>::const_iterator bedItr = bedBlocks.begin(); vector<BED>::const_iterator bedItr = bedBlocks.begin();
vector<BED>::const_iterator bedEnd = bedBlocks.end(); vector<BED>::const_iterator bedEnd = bedBlocks.end();
for (; bedItr != bedEnd; ++bedItr) { for (; bedItr != bedEnd; ++bedItr) {
overlapFoundForBlock = FindOneOrMoreOverlap(a); overlapFoundForBlock = FindOneOrMoreOverlap(*bedItr);
if (overlapFoundForBlock == true) if (overlapFoundForBlock == true)
overlapsFound = true; overlapsFound = true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment