-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_ori.sh
executable file
·67 lines (61 loc) · 2.17 KB
/
run_ori.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
#!/bin/bash
###############################################################################
# Aydin Karatas
# Project Coprolite Viromes
# run_ori.sh
###############################################################################
cd $HOME/project_coprolite_viromes
for FILE in general_bash_functions/* ; do source $FILE ; done
# paleo samples labeled as pal-{location} :
# pal-AWC pal-BEL pal-BMS pal-ENG pal-ZAF pal-ZAP
# industrial samples labeled as ind-{location} :
# ind-DNK ind-ESP ind-USA
# pre-industrial samples labeled as pre-{location} :
# pre-FJI pre-MDG pre-MEX pre-PER pre-TZA
valid_ori=( pal-AWC pal-BEL pal-BMS pal-ENG pal-ZAF pal-ZAP \
ind-DNK ind-ESP ind-USA \
pre-FJI pre-MDG pre-MEX pre-PER pre-TZA \
test all )
# read in arguments by flag and assign them to variables
while getopts "s:o:p:d:c:" opt; do
case $opt in
s) script_name="$OPTARG";;
o) origin="$OPTARG";;
p) project_dir="$OPTARG";;
d) data_per_core="$OPTARG";;
c) cores="$OPTARG";;
*) echo "Unknown option: -$opt" >&2; exit 1;;
esac
done
# check that all arguements were provided
args=("script_name" "origin" "project_dir" "data_per_core" "cores")
for arg in "${args[@]}"; do
# if an argument is empty, it may have not been provided to the script
if [ -z "${!arg}" ]; then
echo "ERROR: missing <$arg>."
echo "Usage Instructions: ./run_ori.sh -s <script_name> -o <origin> -p <project_dir> -d <data_per_core> -c <cores>"
exit 1
# check orgin name to be in the list of valid origins
elif [ "$arg" == "origin" ]; then
check_args "${valid_ori[*]}" "$origin"
fi
done
# run the submission command on hoffman2
if [ "$origin" == "all" ]; then
total_samples=1
else
declare -i total_samples=$(wc -l < ${project_dir}/samples/${origin}_samples.txt)
fi
job_name=$(echo $script_name | cut -d '/' -f 2-)
joblogs_output="$SCRATCH/joblogs/$origin/"
qsub \
-cwd \
-N "${origin}.${job_name}" \
-o $joblogs_output \
-j y \
-l h_rt=24:00:00,h_data=${data_per_core}G \
-pe shared ${cores} \
-M $USER@mail \
-m ea \
-t 1-$total_samples:1 \
$script_name "$origin" "$project_dir" "$cores"