From bd91cd68348f887a0ec0252e69de50d19c78e965 Mon Sep 17 00:00:00 2001
From: Aaron <aaronquinlan@gmail.com>
Date: Tue, 21 Sep 2010 13:19:38 -0400
Subject: [PATCH] windowBed supports -ubam.

---
 src/windowBed/windowBed.cpp | 24 +++++++++++++-----------
 src/windowBed/windowBed.h   |  6 ++++--
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/windowBed/windowBed.cpp b/src/windowBed/windowBed.cpp
index e993a81d..dfd56226 100644
--- a/src/windowBed/windowBed.cpp
+++ b/src/windowBed/windowBed.cpp
@@ -16,8 +16,9 @@
 /*
 	Constructor
 */
-BedWindow::BedWindow(string bedAFile, string bedBFile, int leftSlop, int rightSlop, bool anyHit, bool noHit, 
-					bool writeCount, bool strandWindows, bool matchOnStrand, bool bamInput, bool bamOutput) {
+BedWindow::BedWindow(string bedAFile, string bedBFile, int leftSlop, int rightSlop, 
+                     bool anyHit, bool noHit, bool writeCount, bool strandWindows, 
+                     bool matchOnStrand, bool bamInput, bool bamOutput, bool isUncompressedBam) {
 
 	_bedAFile      = bedAFile;
 	_bedBFile      = bedBFile;
@@ -25,14 +26,15 @@ BedWindow::BedWindow(string bedAFile, string bedBFile, int leftSlop, int rightSl
 	_leftSlop      = leftSlop;
 	_rightSlop     = rightSlop;
 
-	_anyHit        = anyHit;
-	_noHit         = noHit;
-	_writeCount    = writeCount;
-	_strandWindows = strandWindows;	
-	_matchOnStrand = matchOnStrand;
-	_bamInput      = bamInput;
-	_bamOutput     = bamOutput;
-		
+	_anyHit              = anyHit;
+	_noHit               = noHit;
+	_writeCount          = writeCount;
+	_strandWindows       = strandWindows;	
+	_matchOnStrand       = matchOnStrand;
+	_bamInput            = bamInput;
+	_bamOutput           = bamOutput;
+    _isUncompressedBam   = isUncompressedBam;
+    		
 	_bedA          = new BedFile(bedAFile);
 	_bedB          = new BedFile(bedBFile);
 	
@@ -169,7 +171,7 @@ void BedWindow::WindowIntersectBam(string bamFile) {
 	// open a BAM output to stdout if we are writing BAM
 	if (_bamOutput == true) {
 		// open our BAM writer
-		writer.Open("stdout", header, refs);
+		writer.Open("stdout", header, refs, _isUncompressedBam);
 	}
 
 	vector<BED> hits;					// vector of potential hits
diff --git a/src/windowBed/windowBed.h b/src/windowBed/windowBed.h
index b1af9111..5da5cb02 100644
--- a/src/windowBed/windowBed.h
+++ b/src/windowBed/windowBed.h
@@ -32,8 +32,9 @@ class BedWindow {
 public:
 
 	// constructor 
-	BedWindow(string bedAFile, string bedBFile, int leftSlop, int rightSlop, bool anyHit, bool noHit, 
-			  bool writeCount, bool strandWindows, bool matchOnStrand, bool bamInput, bool bamOutput);
+	BedWindow(string bedAFile, string bedBFile, int leftSlop, int rightSlop, 
+	          bool anyHit, bool noHit, bool writeCount, bool strandWindows, 
+	          bool matchOnStrand, bool bamInput, bool bamOutput, bool isUncompressedBam);
 
 	// destructor
 	~BedWindow(void);
@@ -51,6 +52,7 @@ private:
 	bool _matchOnStrand;
 	bool _bamInput;
 	bool _bamOutput;
+    bool  _isUncompressedBam;	
 
 	// instance of a bed file class.
 	BedFile *_bedA, *_bedB;
-- 
GitLab