Skip to content

Commit

Permalink
fix for cleanup crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry-Antipov committed Sep 21, 2024
1 parent 52d7b38 commit 4d75aa0
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/Snakefiles/8-hicPipeline.sm
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ rule scaffoldMergeBWA:
params:
SAMTOOLS = config.get('SAMTOOLS', "{VERKKO}/bin/samtools"),
alignments = lambda wildcards: expand("mapped{nnnn}_nodefiltered.bam", nnnn = splitHICoutputs(wildcards)),
alignments_old = lambda wildcards: expand("mapped{nnnn}.bam", nnnn = splitHICoutputs(wildcards)),
keepinter = config['keep_intermediate']
threads:
int(config['fhc_n_cpus'])
Expand All @@ -395,6 +396,18 @@ set -e

{params.SAMTOOLS} merge -n -@ {threads} ../{output.alignments} {params.alignments}

if [ {params.keepinter} = False ] ; then
rm -f {params.alignments}
rm -f {params.alignments_old}

rm -f ./align_bwa*.err
rm -f ./align_bwa*.sh
rm -f ./scaffold_prefilter*.err
rm -f ./scaffold_prefilter*.sh

rm -f ./unitigs.fasta.*
fi

EOF

chmod +x ./scaffold_mergeBWA.sh
Expand All @@ -416,7 +429,6 @@ rule mergeBWA:
params:
SAMTOOLS = config.get('SAMTOOLS', "{VERKKO}/bin/samtools"),
alignments = lambda wildcards: expand("mapped{nnnn}.bam", nnnn = splitHICoutputs(wildcards)),
keepinter = config['keep_intermediate']
threads:
int(config['fhc_n_cpus'])
resources:
Expand All @@ -435,15 +447,6 @@ set -e
{params.SAMTOOLS} merge -n -@ {threads} - {params.alignments} | samtools view -q 1 -o ../{output.alignments}


if [ {params.keepinter} = False ] ; then
rm -f {params.alignments}

rm -f ./align_bwa*.err
rm -f ./align_bwa*.sh

rm -f ./unitigs.fasta.*
fi

EOF

chmod +x ./mergeBWA.sh
Expand Down

0 comments on commit 4d75aa0

Please sign in to comment.