From 680e672a5bed865a34e9d6cbe847f75320c2d75d Mon Sep 17 00:00:00 2001 From: niekwit <41302859+niekwit@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:06:49 +0100 Subject: [PATCH] removing temp files --- workflow/rules/damid.smk | 6 +++--- workflow/scripts/damidseq_pipeline.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/workflow/rules/damid.smk b/workflow/rules/damid.smk index 91bf2c3..ae5c5a3 100644 --- a/workflow/rules/damid.smk +++ b/workflow/rules/damid.smk @@ -16,7 +16,7 @@ if config["plasmid_fasta"] == "none": ), output: bf=expand("results/bedgraph/{{dir}}/{bg_sample}-vs-Dam-norm.gatc.bedgraph", bg_sample=BG_SAMPLES), - bam=expand("results/bam/{{dir}}/{sample}.bam", sample=SAMPLES), + bam=temp(expand("results/bam/{{dir}}/{sample}.bam", sample=SAMPLES)), params: idxdir=lambda wildcards, input: input["idx"][0][:-6], paired=paired_end, @@ -87,7 +87,7 @@ else: ), output: bf=expand("results/bedgraph/{{dir}}/{bg_sample}-vs-Dam-norm.gatc.bedgraph", bg_sample=BG_SAMPLES), - bam=expand("results/bam/{{dir}}/{sample}.bam", sample=SAMPLES), + bam=temp(expand("results/bam/{{dir}}/{sample}.bam", sample=SAMPLES)), params: idxdir=lambda wildcards, input: input["idx"][0][:-6], paired=paired_end, @@ -153,7 +153,7 @@ else: ), output: bf=expand("results/bedgraph/{{dir}}/{bg_sample}-vs-Dam.norm.gatc.bedgraph", bg_sample=BG_SAMPLES), - bam=expand("results/bam/{{dir}}/{sample}.bam", sample=SAMPLES), + bam=temp(expand("results/bam/{{dir}}/{sample}.bam", sample=SAMPLES)), params: idxdir=lambda wildcards, input: input["idx"][0][:-6], paired=paired_end, diff --git a/workflow/scripts/damidseq_pipeline.py b/workflow/scripts/damidseq_pipeline.py index 5c5811b..8ba384c 100644 --- a/workflow/scripts/damidseq_pipeline.py +++ b/workflow/scripts/damidseq_pipeline.py @@ -151,6 +151,11 @@ def allfastq(directory): new_name = bam.replace("-ext300", "") os.rename(bam, new_name) + # Remove all trimmed fastq files + shell( + "rm results/trimmed/{directory}/*.fastq.gz" + ) + # Destroy temporary directory print(f"Cleaning up temporary directory {temp_dir.name}") temp_dir.cleanup()