-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsnakejob
executable file
·76 lines (60 loc) · 1.57 KB
/
snakejob
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
#!/usr/bin/env bash
# -m {cluster.partition}"
source activate snakemake
set -e
if [ ! -d "cluster" ]; then
mkdir cluster
fi
curdir="$(pwd)"
jname="$(basename $curdir)"
config=$1
if [ ! -e $config ]; then
config_file=config.yaml
else
config_file=$config
fi
# use bash getopt to use short flags
config='config.yaml'
snakefile='Snakefile'
dryrun=""
print_usage() {
printf "Usage: ./snakejob -c config.yaml -s Snakefile\nOptions:\n\t-c config file\n\t-s Snakefile\n\t-n dry run mode\n\t-m mode [eQTL/sQTL]\n\t-i interaction mode (requires interaction file in config.yaml)\n"
}
while getopts 'c:s:m:inh' flag; do
case "${flag}" in
c) config="${OPTARG}" ;;
s) snakefile="${OPTARG}" ;;
n) dryrun="-n" ;;
h) print_usage
exit 1 ;;
esac
done
echo config used is $config
echo snakefile used is $snakefile
if [ ! -z "$dryrun" ];then
echo "dry run mode"
fi
if [ ! -e $config ]; then
echo "error: config file does not exist"
exit 0
fi
if [ ! -e $snakefile ]; then
echo "error: snakefile does not exist"
exit 0
fi
#exit 0
bsub=("bsub -K -J $jname:{rule}:{wildcards}"
"-P acc_als-omics "
"-q {cluster.queue} "
"-n {cluster.cores} -R \"span[hosts=1] select[mem>{cluster.mem}]"
"rusage[mem={cluster.mem}]\" -W {cluster.time} -L /bin/bash"
"-oo cluster/{rule}_{wildcards}.stdout"
"-eo cluster/{rule}_{wildcards}.stderr < ")
snakemake -u cluster.yaml --cluster-sync "${bsub[*]}" \
--local-cores 4 --max-jobs-per-second 5 \
--keep-going \
--jobs 1000 \
--restart-times 3 \
-s $snakefile --configfile $config \
--latency-wait 30 --rerun-incomplete \
$dryrun \