From 3dd4f70c70bfeb8af1a43a1488e7579b5a890995 Mon Sep 17 00:00:00 2001 From: BaileyGlen Date: Wed, 16 Aug 2017 10:35:15 -0400 Subject: [PATCH 1/3] fixing samtools sort output Samtools sort was missing the -o argument, which didn't work with current versions of samtools. I believe this fix will work starting with samtools 1.0 forward. May not work with earlier samtools. Could add in a samtools version check. --- misopy/sam_to_bam.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misopy/sam_to_bam.py b/misopy/sam_to_bam.py index 1ae7e85..16b085e 100644 --- a/misopy/sam_to_bam.py +++ b/misopy/sam_to_bam.py @@ -25,8 +25,8 @@ def sam_to_bam(sam_filename, output_dir, # Sort print "Sorting BAM file..." sorted_filename = "%s.sorted" %(bam_filename.split(".bam")[0]) - cmd = "samtools sort %s %s" %(bam_filename, - sorted_filename) + cmd = "samtools sort -o %s %s" %(sorted_filename, + bam_filename) print " - Executing: %s" %(cmd) os.system(cmd) From 7828fcc7377c3d150b70a83133f6f6998a3af1db Mon Sep 17 00:00:00 2001 From: BaileyGlen Date: Wed, 16 Aug 2017 11:17:45 -0400 Subject: [PATCH 2/3] Update sam_to_bam.py --- misopy/sam_to_bam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misopy/sam_to_bam.py b/misopy/sam_to_bam.py index 16b085e..a0e1e91 100644 --- a/misopy/sam_to_bam.py +++ b/misopy/sam_to_bam.py @@ -24,7 +24,7 @@ def sam_to_bam(sam_filename, output_dir, # Sort print "Sorting BAM file..." - sorted_filename = "%s.sorted" %(bam_filename.split(".bam")[0]) + sorted_filename = "%s.sorted.bam" %(bam_filename.split(".bam")[0]) cmd = "samtools sort -o %s %s" %(sorted_filename, bam_filename) print " - Executing: %s" %(cmd) From 02a11509f338bd8a03764b7c06bde412bf5a066a Mon Sep 17 00:00:00 2001 From: BaileyGlen Date: Wed, 16 Aug 2017 11:24:29 -0400 Subject: [PATCH 3/3] Update sam_to_bam.py --- misopy/sam_to_bam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misopy/sam_to_bam.py b/misopy/sam_to_bam.py index a0e1e91..d56ff07 100644 --- a/misopy/sam_to_bam.py +++ b/misopy/sam_to_bam.py @@ -31,7 +31,7 @@ def sam_to_bam(sam_filename, output_dir, os.system(cmd) # Index - final_filename = "%s.bam" %(sorted_filename) + final_filename = "%s" %(sorted_filename) print "Indexing BAM..." cmd = "samtools index %s" %(final_filename) print " - Executing: %s" %(cmd)