-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_locus_batches.sh
executable file
·59 lines (47 loc) · 1.47 KB
/
run_locus_batches.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
#!/usr/bin/env bash
# Author: Evan K. Irving-Pease
# Copyright: Copyright 2020, University of Copenhagen
# Email: [email protected]
# License: MIT
# get the command line arguments
args=("$@")
datetime=$(date +%Y-%m-%d-%H%M)
# make a unique log file
logfile="nohup-${datetime}.out"
dataset=${args[0]:='ancestral_paths_v3'}
population=${args[1]:='all'}
batches=${args[2]:=100}
# print the server name and start time to the log file
echo "SERVER: $HOSTNAME" >>${logfile}
echo "DATE: ${datetime}" >>${logfile}
echo "DATASET: ${dataset}-${population}" >>$logfile
# load the conda environment
eval "$(conda shell.bash hook)"
conda activate mesoneo
MAX_ENSEMBL=15
MAX_MATPLOTLIB=20
if ! command -v free &> /dev/null; then
# MacOS does not have the free command
MAX_MEM=$(sysctl -a | awk '/^hw.memsize:/{print $2/(1024)^2}')
else
# but linux does
MAX_MEM=$(free -m | awk '/^Mem:/{print $2}')
fi
flags="--cores all "
flags+="--nolock "
flags+="--keep-going "
flags+="--printshellcmds "
flags+="--show-failed-logs "
flags+="--keep-incomplete "
flags+="--rerun-incomplete "
flags+="--reason "
#flags+="--restart-times 1 "
flags+="--resources mem_mb=${MAX_MEM} ensembl_api=${MAX_ENSEMBL} matplotlib=${MAX_MATPLOTLIB} "
for batch in $(seq 1 ${batches}); do
echo "Starting batch ${batch} for locus..." >>$logfile
(
set -x
snakemake ${flags} --config dataset=${dataset} population=${population} batch=${batch} -- locus
) &>>${logfile}
done
echo "DONE!" >>${logfile}