-
Notifications
You must be signed in to change notification settings - Fork 2
/
pipeline.bash
98 lines (79 loc) · 2.51 KB
/
pipeline.bash
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
#!/bin/sh
#Run the SQANTI3 pipeline
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
REALPATH="$(realpath "$0")"
BASEDIR="$(dirname "$REALPATH")"
case "$BASEDIR" in
/*)
true
;;
*)
BASEDIR="${PWD}/$BASEDIR"
;;
esac
LRGASP_DIR="${BASEDIR}"/lrgasp_data
TAG=1.0.0
if [ $# -gt 1 ] ; then
input_file="$1"
RESDIR="$3"
TAG="$2"
challenges="$4"
if [ $# -gt 4 ] ; then
for i in $(seq 5 $#); do
eval "arg=\${$i}"
challenges+=" $arg"
done
fi
cat <<EOF
* Using version $TAG
* Running parameters
Input file: $input_file
Results: $RESDIR
Tag: $TAG
Challenges: $challenges
EOF
echo "* Deriving input directory"
inputRealPath="$(realpath "$input_file")"
echo $inputRealPath
inputBasename="$(basename "$input_file")"
INPUTDIR="$(dirname "$inputRealPath")"
echo $INPUTDIR
case "$INPUTDIR" in
/*)
true
;;
*)
INPUTDIR="${PWD}/$INPUTDIR"
;;
esac
echo "* Creating $RESDIR (if it does not exist)"
mkdir -p "$RESDIR"
# REMEMBER: We need absolute paths for docker
RESDIRreal="$(realpath "$RESDIR")"
case "$RESDIRreal" in
/*)
true
;;
*)
RESDIRreal="${PWD}/$RESDIRreal"
;;
esac
ASSESSDIR="${LRGASP_DIR}"/data
METRICS_DIR="${LRGASP_DIR}"/metrics_ref_datasets
PUBLIC_REF_DIR="${LRGASP_DIR}"/public_ref
echo "=> Validating input" && \
docker run --rm -u $UID -v "${INPUTDIR}":/app/input:rw -v "${RESDIRreal}":/app/output:rw lrgasp_validation:"$TAG" \
-i /app/input/$inputBasename -o /app/output/participant.json --challenges "$challenges" -m && \
echo "=> Computing metrics" && \
docker run --rm -u $UID -v lrgasp_metrics/utilities:/app/utilities:rw -v "${INPUTDIR}":/app/input:rw -v "${METRICS_DIR}":/app/metrics:rw -v "${RESDIRreal}":/app/output:rw lrgasp_metrics:"$TAG" \
--input-gz-file /app/input/$inputBasename --manifest --ref-directory /app/input/public_ref --gtf -d /app/output/results/ -o results --assesment-output /app/output/assessment.json --challenges "$challenges" && \
echo "=> Assessing metrics" && \
docker run --rm -u $UID -v "${INPUTDIR}":/app/input:rw -v "${ASSESSDIR}":/app/assess:rw -v "${RESDIRreal}":/app/output:rw lrgasp_consolidation:"$TAG" \
-b /app/assess/ -p /app/output/assessment.json -o /app/output/ -i /app/input/$inputBasename -m --offline OFFLINE && \
echo "* Pipeline has finished properly"
else
echo "Usage: $0 input_file TAG results_dir challenges"
echo "When running, please ensure all the needed files are in the input_file, included the manifest with the filenames. The output dir must also be a full path"
fi