-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·103 lines (79 loc) · 2.76 KB
/
run.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
#!/bin/sh
set -u
#
# Checking args
#
source scripts/config.sh
if [[ ! -f "$V_DATASET" ]]; then
echo "$V_DATASET does not exist. Please provide a viral training set file to process Job terminated."
exit 1
fi
if [[ ! -f "$H_DATASET" ]]; then
echo "$H_DATASET does not exist. Please provide a host training set file to process Job terminated."
exit 1
fi
if [[ $SPLIT_SIZE -lt 1 ]]; then
echo "Incorrect split set size value. Please correct specified parameter in config file. Job terminated."
exit 1
fi
if [[ $ENS_SIZE -lt 2 ]]; then
echo "Incorrect ensemble size value. Please correct specified parameter in config file. Job terminated."
exit 1
fi
export NUMV=$(grep -c '>' $V_DATASET)
if [ $SPLIT_SIZE -gt $NUMV ]; then
echo "$NUMV sequences are available for viral training. Please provide a $SPLIT_SIZE inferior to $NUMV in config file."
exit 1
fi
export NUMH=$(grep -c '>' $H_DATASET)
if [ $SPLIT_SIZE -gt $NUMH ]; then
echo "$NUMH sequences are available for viral training. Please provide a $SPLIT_SIZE inferior to $NUMH in config file."
exit 1
fi
if [[ $KM_SIZE -lt 1 ]]; then
echo "Incorrect kmer size value. Please correct specified parameter in config file. Job terminated."
exit 1
fi
if [[ ! -d "$RESULT_DIR" ]]; then
echo "$RESULT_DIR does not exist. Directory created for pipeline output."
mkdir -p "$RESULT_DIR"
fi
#
# Job submission
#
PREV_JOB_ID=""
ARGS="-q $QUEUE -W group_list=$GROUP -M $MAIL_USER -m $MAIL_TYPE"
#
## 01-run split training set
#
PROG="01-run-split"
export STDERR_DIR="$SCRIPT_DIR/err/$PROG"
export STDOUT_DIR="$SCRIPT_DIR/out/$PROG"
init_dir "$STDERR_DIR" "$STDOUT_DIR"
echo "Ensemble of size $ENS_SIZE trained on $SPLIT_SIZE sequences with k=$KM_SIZE requested"
echo "launching $SCRIPT_DIR/run_analysis_array.sh "
JOB_ID=`qsub $ARGS -v WORKER_DIR,SPLIT_SIZE,ENS_SIZE,NUMV,NUMH,H_DATASET,V_DATASET,RESULT_DIR,STDERR_DIR,STDOUT_DIR -N run_randomizer -e "$STDERR_DIR" -o "$STDOUT_DIR" -J 1-2 $SCRIPT_DIR/run_split.sh`
if [ "${JOB_ID}x" != "x" ]; then
echo Job: \"$JOB_ID\"
PREV_JOB_ID=$JOB_ID
else
echo Problem submitting job. Job terminated
fi
echo "job successfully submited"
#
## 02-run training
#
PROG="02-train"
export STDERR_DIR2="$SCRIPT_DIR/err/$PROG"
export STDOUT_DIR2="$SCRIPT_DIR/out/$PROG"
init_dir "$STDERR_DIR2" "$STDOUT_DIR2"
echo "launching $SCRIPT_DIR/run_train.sh"
mkdir "$RESULT_DIR/models_trained"
JOB_ID=`qsub $ARGS -v WORKER_DIR,RESULT_DIR,KM_SIZE,STDERR_DIR2,STDOUT_DIR2 -N run_train -e "$STDERR_DIR2" -o "$STDOUT_DIR2" -J 1-$ENS_SIZE -W depend=afterok:$PREV_JOB_ID $SCRIPT_DIR/run_train.sh`
if [ "${JOB_ID}x" != "x" ]; then
echo Job: \"$JOB_ID\"
PREV_JOB_ID=$JOB_ID
else
echo Problem submitting job. Job terminated
fi
echo "job successfully submited"