From e200d064f3812489e89a8b6cbb4fc02aac74cd90 Mon Sep 17 00:00:00 2001
From: Aaron <aaronquinlan@gmail.com>
Date: Sat, 3 Jul 2010 22:02:10 -0400
Subject: [PATCH] Fixed string references for strand (i.e. '+' to "+") in
 windowBed and pairToBed.

---
 src/pairToBed/pairToBed.h     | 8 ++++----
 src/utils/bedFile/bedFile.cpp | 2 ++
 src/windowBed/windowBed.cpp   | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/pairToBed/pairToBed.h b/src/pairToBed/pairToBed.h
index 66a26eb8..420426f8 100755
--- a/src/pairToBed/pairToBed.h
+++ b/src/pairToBed/pairToBed.h
@@ -95,8 +95,8 @@ private:
 			a.chrom1  = refs.at(bam1.RefID).RefName;
 			a.start1  = bam1.Position;
 			a.end1    = bam1.GetEndPosition();
-			a.strand1 = '+';
-			if (bam1.IsReverseStrand()) a.strand1 = '-';
+			a.strand1 = "+";
+			if (bam1.IsReverseStrand()) a.strand1 = "-";
 			
 			// extract the edit distance from the NM tag
 			// if possible. otherwise, complain.
@@ -113,8 +113,8 @@ private:
 			a.chrom2  = refs.at(bam2.RefID).RefName;
 			a.start2  = bam2.Position;
 			a.end2    = bam2.GetEndPosition();
-			a.strand2 = '+';
-			if (bam2.IsReverseStrand()) a.strand2 = '-';
+			a.strand2 = "+";
+			if (bam2.IsReverseStrand()) a.strand2 = "-";
 			
 			// extract the edit distance from the NM tag
 			// if possible. otherwise, complain.
diff --git a/src/utils/bedFile/bedFile.cpp b/src/utils/bedFile/bedFile.cpp
index 4ffe3e70..b97c404a 100755
--- a/src/utils/bedFile/bedFile.cpp
+++ b/src/utils/bedFile/bedFile.cpp
@@ -422,6 +422,8 @@ void BedFile::countSplitHits(const vector<BED> &bedBlocks, bool forceStrand) {
     set< vector<BEDCOV>::iterator >::iterator validHitsItr = validHits.begin();
     set< vector<BEDCOV>::iterator >::iterator validHitsEnd = validHits.end();
     for (; validHitsItr != validHitsEnd; ++validHitsItr)
+        // the validHitsItr points to another itr, hence the (*itr)-> dereferencing.
+        // ugly, but that's C++.
         (*validHitsItr)->count++;
 }
 
diff --git a/src/windowBed/windowBed.cpp b/src/windowBed/windowBed.cpp
index e1809f79..e993a81d 100755
--- a/src/windowBed/windowBed.cpp
+++ b/src/windowBed/windowBed.cpp
@@ -194,7 +194,7 @@ void BedWindow::WindowIntersectBam(string bamFile) {
 			if (bam.IsSecondMate()) a.name += "/2";
 
 			a.score  = ToString(bam.MapQuality);
-			a.strand = '+'; if (bam.IsReverseStrand()) a.strand = '-'; 
+			a.strand = "+"; if (bam.IsReverseStrand()) a.strand = "-"; 
 	
 			if (_bamOutput == true) {
 				overlapsFound = FindOneOrMoreWindowOverlaps(a);
-- 
GitLab