From ab7bbbe407eed1a33f44e20778babfc4f71a61ac Mon Sep 17 00:00:00 2001
From: Aaron <aaronquinlan@gmail.com>
Date: Sat, 24 Aug 2013 22:30:58 -0400
Subject: [PATCH] [BUG] -split, -tag and BED6 output was not implemented.

---
 src/bamToBed/bamToBed.cpp | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/bamToBed/bamToBed.cpp b/src/bamToBed/bamToBed.cpp
index 432a0f63..c89441a0 100644
--- a/src/bamToBed/bamToBed.cpp
+++ b/src/bamToBed/bamToBed.cpp
@@ -479,13 +479,26 @@ void PrintBed(const BamAlignment &bam,  const RefVector &refs,
         unsigned int i;
         for (i = 0; i < bedBlocks.size(); ++i) {
             BED curr = bedBlocks[i];
-            printf("%s\t%d\t%d\t\%s\t%d\t%s\n", 
-                   chrom.c_str(), 
-                   curr.start,
-                   curr.end,
-                   name.c_str(),
-                   bam.MapQuality,
-                   strand.c_str());
+
+            if (bamTag == "") {
+                printf("%s\t%d\t%d\t\%s\t%d\t%s\n", 
+                       chrom.c_str(), 
+                       curr.start,
+                       curr.end,
+                       name.c_str(),
+                       bam.MapQuality,
+                       strand.c_str());
+            }
+            else {
+                cout << chrom << "\t"
+                     << bam.Position << "\t"
+                     << curr.start << "\t"
+                     << curr.end << "\t"
+                     << name << "\t"
+                     << PrintTag(bam, bamTag) << "\t"
+                     << strand
+                     << endl;            
+            }
         }
     }
 }
-- 
GitLab