-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrunGeCKO.sh
More file actions
executable file
·168 lines (125 loc) · 3.51 KB
/
Copy pathrunGeCKO.sh
File metadata and controls
executable file
·168 lines (125 loc) · 3.51 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/usr/bin/env bash
set -eo pipefail
SingularityImageVersion=1.2.1
### v WRITE YOUR MODULE LOAD OR CONDA ACTIVATE HERE v ###
#module purge
#module load snakemake/7.32.4-conda
#module load singularity/3.6.3
### ^ WRITE YOUR MODULE LOAD OR CONDA ACTIVATE HERE ^ ###
### DEFAULT OPTIONS
JOBS="--jobs 1"
LATENCY_WAIT="--latency-wait 20"
### DEFAULT ACTION VALUES
HELP="FALSE"
### ARGUMENTS
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--help)
HELP="TRUE"
shift # past argument
;;
--workflow)
WORKFLOW="$2"
shift
shift
;;
--cluster-profile)
CLUSTER_PROFILE="$2"
shift
shift
;;
--config-file)
CONFIG="$2"
shift
shift
;;
--jobs)
JOBS="--jobs $2"
shift
shift
;;
--forceall)
FORCEALL="--forceall"
shift
;;
--latency-wait)
LATENCY_WAIT="--latency-wait $2"
shift
shift
;;
--dryrun)
DRYRUN="--dryrun"
shift
;;
--report)
REPORT="--report $2"
shift
shift
;;
--extra-snakemake-options)
EXTRA_SNAKEMAKE_OPTIONS="$2"
shift
shift
;;
-*)
echo -e "\nWARNING: $1 option is unknown and will be ignored.\n"
POSITIONAL+=("$1")
shift
;;
*)
POSITIONAL+=("$1")
shift
;;
esac
done
set -- "${POSITIONAL[@]}"
# --------------------------------------------------------------------------------------------------------------#
printAbsolutePath () {
if [[ ! -z "$1" ]] ; then
fileOrFolder_printAbsolutePath=$(readlink -f "$1") ;
echo ${fileOrFolder_printAbsolutePath}
else
echo $1
fi
}
# --------------------------------------------------------------------------------------------------------------#
### Paths
GeCKO_path=$(dirname $(printAbsolutePath "$0"))
checks_path="${GeCKO_path}/utils/launching"
# --------------------------------------------------------------------------------------------------------------#
### Functions
source "${checks_path}/launching_utils.sh"
# --------------------------------------------------------------------------------------------------------------#
### Check if launcher_files folder exists
checkMissingDir $checks_path "GeCKOdir"
### Check if Singularity/Apptainer and Snakemake are available
isAvailable "Snakemake" "snakemake"
isAvailable "Singularity/Apptainer" "singularity"
### Download the singularity container if it can't be found
GeCKO_sif="${GeCKO_path}/utils/singularity_image/GeCKO.sif"
dlImageSylabs "library://ge2pop_gecko/gecko/gecko:${SingularityImageVersion}" "${GeCKO_sif}"
### Make scripts executable
for script in $(ls ${checks_path}/*.sh) ; do
makeExecutable $script
done
### Print the help
if [ "${HELP}" = "TRUE" ] ; then
cat ${checks_path}/launcher_help.txt
exit 0
fi
### Check variables and paths
source "${checks_path}/allWorkflowsCheck.sh"
if [[ -f "${checks_path}/${WORKFLOW}Check.sh" ]] ; then
source "${checks_path}/${WORKFLOW}Check.sh"
fi
### Unlock in case the folder is locked
snakemake --snakefile ${workflow_path}/${WORKFLOW_SMK} $JOBS --unlock --configfile ${CONFIG}
### RUN THE WORKFLOW
snakemake_command="snakemake --snakefile ${workflow_path}/${WORKFLOW_SMK} --printshellcmds $FORCEALL $DRYRUN $REPORT $LATENCY_WAIT $JOBS --use-singularity --configfile ${CONFIG} ${PROFILE} --config configfile_name=${CONFIG} clusterprofile_name=${PROFILE_FILE} ${EXTRA_SNAKEMAKE_OPTIONS} --singularity-args \"--bind ${GeCKO_path} --bind $(pwd) --bind ${HOME}\""
echo -e "\nCalling Snakemake:"
echo -e $snakemake_command"\n"
eval $snakemake_command
exit 0