Skip to content

Commit

Permalink
Delete previous runs flye output directory if it exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
skchronicles committed Mar 12, 2024
1 parent 14fc5bb commit 1fcafb6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -279,22 +279,25 @@ rule flye_assembly:
rname="flye_assembly",
flye="flye/2.9.1",
id="{samples}",
dir= join(workpath,"flye_assembly"),
outdir= join(workpath,"flye_assembly"),
genome_size_flag= "--genome-size" if Genome_size != "" else "",
asm_coverage_flag= "--asm-coverage" if Coverage != "" else ""
threads: int(allocated("threads", "flye_assembly", cluster)),
shell:
"""
module load {params.flye}
mkdir -p {params.rname}
if [ -d "{params.outdir}/{params.id}" ]; then
rm -rf "{params.outdir}/{params.id}";
fi
mkdir -p "{params.outdir}/{params.id}"
cd /lscratch/$SLURM_JOBID
mkdir -p {params.rname}/{params.id}
flye \\
--threads {threads} \\
--pacbio-hifi {input} {params.genome_size_flag} {Genome_size} \\
--out-dir {params.rname}/{params.id} {params.asm_coverage_flag} {Coverage}
mv /lscratch/$SLURM_JOBID/{params.rname}/{params.id} {params.dir}
cd {params.dir}/{params.id}
mv /lscratch/$SLURM_JOBID/{params.rname}/{params.id} {params.outdir}
cd {params.outdir}/{params.id}
mv assembly.fasta {output}
"""

Expand Down Expand Up @@ -470,3 +473,7 @@ rule busco_summaries:
-rt specific \\
--working_directory {params.dir}
"""


# Import rules
include: join("rules", "hooks.smk")

0 comments on commit 1fcafb6

Please sign in to comment.