-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_nextflow_wes_fingerprint.sh
executable file
·70 lines (56 loc) · 1.54 KB
/
run_nextflow_wes_fingerprint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -euo pipefail
workflow_path='/hpc/diaggen/software/production/DxNextflowWES'
# Set input and output dirs
input=`realpath -e $1`
output=`realpath $2`
email=$3
mkdir -p $output && cd $output
mkdir -p log
if ! { [ -f 'workflow.running' ] || [ -f 'workflow.done' ] || [ -f 'workflow.failed' ]; }; then
touch workflow.running
sbatch <<EOT
#!/bin/bash
#SBATCH --time=2:00:00
#SBATCH --nodes=1
#SBATCH --mem 5G
#SBATCH --gres=tmpspace:10G
#SBATCH --job-name Nextflow_WES_Fingerprint
#SBATCH -o log/slurm_nextflow_wes_fingerprint.%j.out
#SBATCH -e log/slurm_nextflow_wes_fingerprint.%j.err
#SBATCH --mail-user $email
#SBATCH --mail-type FAIL
#SBATCH --export=NONE
#SBATCH --account=diaggen
module load Java/1.8.0_60
/hpc/diaggen/software/tools/nextflow run $workflow_path/WES_Fingerprint.nf \
-c $workflow_path/WES.config \
--bam_path $input \
--outdir $output \
--email $email \
-profile slurm \
-resume -ansi-log false
if [ \$? -eq 0 ]; then
echo "Nextflow done."
echo "Zip work directory"
find work -type f | egrep "\.(command|exitcode)" | zip -@ -q work.zip
echo "Remove work directory"
rm -r work
echo "WES Fingerprint workflow completed successfully."
rm workflow.running
touch workflow.done
echo "Change permissions"
chmod 775 -R $output
exit 0
else
echo "Nextflow failed"
rm workflow.running
touch workflow.failed
echo "Change permissions"
chmod 775 -R $output
exit 1
fi
EOT
else
echo "Workflow job not submitted, please check $output for 'workflow.status' files."
fi