Skip to content

Commit bcb65b3

Browse files
committed
no more bam files ending with -ext300.bam
1 parent fd51e21 commit bcb65b3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

workflow/scripts/damidseq_pipeline.py

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from pathlib import Path
1212
import tempfile
1313
import pandas as pd
14+
import glob
1415
from snakemake.shell import shell
1516

1617
def move_files(extension):
@@ -129,6 +130,14 @@ def allfastq(directory):
129130
# Move bam files to output directory
130131
move_files("bam")
131132

133+
if not paired:
134+
# Rename bam files so that they end with .bam and not -ext300.bam
135+
bam_files = glob.glob(f"results/bam/{directory}/*-ext300.bam")
136+
assert len(bam_files) > 0, "No single-end bam files found to remove -ext300 from file name..."
137+
for bam in bam_files:
138+
new_name = bam.replace("-ext300", "")
139+
os.rename(bam, new_name)
140+
132141
# Destroy temporary directory
133142
print(f"Cleaning up temporary directory {temp_dir.name}")
134143
temp_dir.cleanup()

0 commit comments

Comments
 (0)