From 7ae8a4d485ae26a88611828049759aab678d6cdd Mon Sep 17 00:00:00 2001
From: Aaron <aaronquinlan@gmail.com>
Date: Sun, 4 Jul 2010 21:15:58 -0400
Subject: [PATCH] Added slop to filename when using -slop in bedToIgv.

---
 src/bedToIgv/bedToIgv.cpp | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/bedToIgv/bedToIgv.cpp b/src/bedToIgv/bedToIgv.cpp
index 5c116029..4df564dd 100755
--- a/src/bedToIgv/bedToIgv.cpp
+++ b/src/bedToIgv/bedToIgv.cpp
@@ -236,19 +236,20 @@ void ProcessBed(istream &bedInput, BedFile *bed, string path, string sortType, s
 	while ((bedStatus = bed->GetNextBed(bedEntry, lineNum)) != BED_INVALID) {        
 		if (bedStatus == BED_VALID) {
             
-            string locus, filename;
-            locus = bedEntry.chrom + ":" + ToString(bedEntry.start - slop) + "-" + ToString(bedEntry.end + slop);
+            string filename = bedEntry.chrom + ":" + ToString(bedEntry.start) + "-" + ToString(bedEntry.end);
+            string locus    = bedEntry.chrom + ":" + ToString(bedEntry.start - slop) + "-" + ToString(bedEntry.end + slop);
             
-            if (useNames == false)
-                filename = locus;
-            else {
+            if (useNames == true) {
                 if (bedEntry.name.empty() == false)
-                    filename = bedEntry.name;
+                    filename = filename + "_" + bedEntry.name;
                 else {
                     cerr << "Error: You requested that filenames be based upon the name field.  However, it appears to be empty. Exiting!" << endl;
         			exit (1);
                 }  
             }
+            if (slop > 0) {
+                filename = filename + "_" + "slop" + ToString(slop);
+            }
             // goto
             cout << "goto " << locus << endl;
 
@@ -262,7 +263,7 @@ void ProcessBed(istream &bedInput, BedFile *bed, string path, string sortType, s
             
             // snapshot
             cout << "snapshot " << filename << "." << imageType << endl;
-            
+                
             // reset
 			bedEntry = nullBed;
 		}
-- 
GitLab