forked from SouthGreenPlatform/culebrONT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit_culebront.sh
executable file
·116 lines (103 loc) · 3.99 KB
/
submit_culebront.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
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
#!/bin/bash
verbose=false
# module help
function help
{
printf "\033[36m####################################################################\n";
printf "# submit_culebrONT #\n";
printf "####################################################################\n";
printf "
Usage: ./submit_culebrONT.sh -c {file} -k {file} -a {additional} -p {profile}
options:
-c {file} = Configuration file for run CulebrONT
-k {file} = Configuration file cluster for run CulebrONT
-p {path} = Cluster profile
-a {string} = additional snakemake arguments
-h = see help
Example usage LOCAL:
./submit_culebrONT.sh -c config.yaml
./submit_culebrONT.sh -c config.yaml -a \"--dry-run --cores 1\"
Example usage CLUSTER:
./submit_culebrONT.sh -c config.yaml -p CulebrONT_SLURM
./submit_culebrONT.sh -c config.yaml -p CulebrONT_SLURM -k cluster_config.yaml
./submit_culebrONT.sh -c config.yaml -p CulebrONT_SLURM -k cluster_config.yaml -a \"--dry-run --cores 1\"
At least a config.yaml file is needed to run CulebrONT*
If you are on LOCAL MODE, -p and -k arguments are NOT needed
If you are on CLUSTER MODE, please provide the profile path generated according of your favorite scheduler (-p ).
* You can modify cluster resources giving a cluster_config.yaml (-k) (overwrite profile cluster configuration)\n"
exit 0
}
##################################################
## Parse command line options.
while getopts c:k:h:p:a:v OPT;
do case $OPT in
c) config=$OPTARG;;
k) cluster_config=$OPTARG;;
p) profile=$OPTARG;;
a) additional=$OPTARG;;
v) verbose=true;;
h) help;;
\?) help;;
esac
done
if [ $# -eq 0 ]; then
help
fi
##################################################
## main
##################################################
# check config
if [ -n "$config" ] && [ -e "$config" ]; then
config=$(realpath "$config")
$verbose && echo "CONFIG FILE IS $config"
else
printf "\033[31m \n\n ERROR : you need to provide a valid CONFIG FILE ! \n\n"
echo "CONFIG FILE IS $config"
exit;
fi
# cluster_config T et profile T
if [[ -d "${profile}" ]] && [[ -n "${cluster_config}" ]] && [[ -e "$cluster_config" ]]; then
profile=$(realpath "$profile")
cluster_config=$(realpath "$cluster_config")
$verbose && echo "PROFILE DIR IS" "$profile"
$verbose && echo "CLUSTER CONFIG IS" "$cluster_config"
$verbose && echo "snakemake -p -s $CULEBRONT/Snakefile \
--configfile $config \
--cluster-config $cluster_config \
--profile $profile \
$additional"
snakemake -p -s ${CULEBRONT}/Snakefile \
--configfile ${config} \
--cluster-config ${cluster_config} \
--profile ${profile} \
${additional}
# cluster_config F et profile T
elif [[ -d "${profile}" ]] && [[ -z ${cluster_config} ]] && [[ ! -e $cluster_config ]]; then
profile=$(realpath "$profile")
$verbose && echo "PROFILE DIR IS $profile"
$verbose && echo "CLUSTER CONFIG IN PROFILE IS ${profile}/cluster_config.yaml"
$verbose && echo "snakemake -p -s $CULEBRONT/Snakefile \
--configfile $config \
--profile $profile \
$additional"
snakemake -p -s ${CULEBRONT}/Snakefile \
--configfile ${config} \
--profile ${profile} \
${additional}
# cluster_config F, profile F
elif [[ ! $profile ]] && [[ ! $cluster_config ]]; then
$verbose && echo "You are running on $(uname -a)"
$verbose && echo "snakemake -p -s $CULEBRONT/Snakefile \
--configfile $config \
--use-singularity --singularity-args --bind ${test_dir} \
$additional"
snakemake -p -s ${CULEBRONT}/Snakefile \
--configfile ${config} \
--use-singularity --singularity-args "--bind ${test_dir}" \
${additional}
# cluster_config T, profile F
elif [[ ! $profile ]] && [[ $cluster_config ]]; then
echo "You need verify CulebrONT arguments compatiblity. Please provide path to CLUSTER profile and cluster_config.yaml"
help
exit;
fi