-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbsv-R1-S17_hc_checklogs_run_parallel.pbs
executable file
·83 lines (64 loc) · 2.45 KB
/
bsv-R1-S17_hc_checklogs_run_parallel.pbs
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
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
#########################################################
#
# Platform: NCI Gadi HPC
# Description: run parallel error checking on step 16 and write failed tasks list if any
# Author: Cali Willet
# cali.willet@sydney.edu.au
# Date last modified: 14/10/2020
#
# If you use this script towards a publication, please acknowledge the
# Sydney Informatics Hub (or co-authorship, where appropriate).
#
# Suggested acknowledgement:
# The authors acknowledge the scientific and technical assistance
# <or e.g. bioinformatics assistance of <PERSON> of Sydney Informatics
# Hub and resources and services from the National Computational
# Infrastructure (NCI), which is supported by the Australian Government
# with access facilitated by the University of Sydney.
#
#########################################################
#PBS -P <project>
#PBS -N bsv-R1-S17
#PBS -l walltime=00:10:00
#PBS -l ncpus=37
#PBS -l mem=148GB
#PBS -q express
#PBS -W umask=022
#PBS -l wd
#PBS -o ./Logs/bsv-R1-S17.o
#PBS -e ./Logs/bsv-R1-S17.e
#PBS -lstorage=<lstorage>
module load openmpi/4.0.2
module load nci-parallel/1.0.0
set -e
round=<round>
SCRIPT=./bsv-R1-S17_hc_checklogs.pl
INPUTS=./Inputs/hc_checklogs.inputs
OUTPUTS=./Inputs/hc_checklogs_missing.inputs # if this script discovers any failed tasks, they will be written here
NCPUS=1
#########################################################
# Do not edit below this line
#########################################################
if [[ $PBS_QUEUE =~ bw-exec ]]; then CPN=28; else CPN=48; fi
M=$(( CPN / NCPUS )) #tasks per node
sed "s|^|${SCRIPT} |" ${INPUTS} > ${PBS_JOBFS}/input-file
mpirun --np $((M * PBS_NCPUS / CPN)) \
--map-by node:PE=${NCPUS} \
nci-parallel \
--verbose \
--input-file ${PBS_JOBFS}/input-file
#########################################################
# Now report the samples with failed intervals, and make a list for rerunning
# The reports cannot be made from within the parallel tasks, as they will overwrite each other to the .o file
find ./GATK_logs/HC_round${round}/ -name *_errors.txt -print | xargs cat > $OUTPUTS
tasks=`wc -l < $OUTPUTS`
if [[ $tasks -gt 0 ]]
then
printf "Number of failed GATK4 HC tasks: ${tasks}\nPlease use $OUTPUTS as input to bsv-R${round}-S16_hc_missing_run_parallel.pbs\n"
else
printf "No failed GATK4 HC tasks were detected.Tidying up...\n"
rm -rf $OUTPUTS
cd ./GATK_logs/HC_round${round}
tar --remove-files -czf haplotypecaller_logs.tar.gz *
fi