-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmiracum_pipe.sh
executable file
·114 lines (98 loc) · 3.87 KB
/
miracum_pipe.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
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env bash
readonly DIR_MIRACUM="/opt/MIRACUM-Pipe"
function join_by { local IFS="$1"; shift; echo "$*"; }
function usage() {
docker run -it --name run-miracum-pipeline --rm $1:$2 "${DIR_MIRACUM}"/miracum_pipe.sh -h
echo ""
echo "additional optional flags:"
echo " -r set temporary folder into RAM"
echo " -n docker repo name (default is agboerries/miracum_pipe)"
echo " -v version specify version (default is \"latest\")"
exit 1
}
PARAM_DOCKER_REPO_NAME="agboerries/miracum_pipe"
readonly VALID_PROTOCOLS=("wes panel tumorOnly")
while getopts t:p:d:v:n:fsrh option; do
case "${option}" in
t) readonly PARAM_TASK=$OPTARG;;
p) readonly PARAM_PROTOCOL=$OPTARG;;
f) readonly PARAM_FORCED=true;;
d) readonly PARAM_DIR_PATIENT=$OPTARG;;
v) PIPELINE_VERSION=$OPTARG;;
r) readonly PARAM_RAM=$OPTARG;;
s) readonly PARAM_SEQ=true;;
n) PARAM_DOCKER_REPO_NAME=$OPTARG;;
h) readonly SHOW_USAGE=true;;
\?)
echo "Unknown option: -$OPTARG" >&2
exit 1
;;
:)
echo "Missing option argument for -$OPTARG" >&2
exit 1
;;
*)
echo "Unimplemented option: -$OPTARG" >&2
exit 1
;;
esac
done
[[ -z "${PIPELINE_VERSION}" ]] && PIPELINE_VERSION='latest'
[[ "${SHOW_USAGE}" ]] && usage "${PARAM_DOCKER_REPO_NAME}" "${PIPELINE_VERSION}"
if [[ ! -z "${PARAM_PROTOCOL}" ]]; then
if [[ ! " ${VALID_PROTOCOLS[@]} " =~ " ${PARAM_PROTOCOL} " ]]; then
echo "unknown protocol: ${PARAM_PROTOCOL}"
echo "use one of the following values: $(join_by ' ' ${VALID_PROTOCOLS})"
exit 1
fi
elif [[ -z "${PARAM_PROTOCOL}" ]]; then
echo "no protocol specified!"
exit 1
fi
# conf as volume
if [[ -d $(pwd)/conf ]]; then
readonly VOLUME_CONF="-v $(pwd)/conf/custom.yaml:${DIR_MIRACUM}/conf/custom.yaml"
fi
# call script
if [[ "${PARAM_FORCED}" ]]; then
opt_args='-f'
fi
if [[ "${PARAM_TASK}" ]]; then
opt_args="${opt_args} -t ${PARAM_TASK}"
fi
if [[ "${PARAM_PROTOCOL}" ]]; then
opt_args="${opt_args} -p ${PARAM_PROTOCOL}"
fi
if [[ "${PARAM_SEQ}" ]]; then
opt_args="${opt_args} -s"
fi
if [[ "${PARAM_DIR_PATIENT}" ]]; then
opt_args="${opt_args} -d ${PARAM_DIR_PATIENT}"
fi
# tmp in ram
if [[ "${PARAM_RAM}" ]]; then
readonly TMP_RAM="--tmpfs /tmp:exec"
fi
echo "running \"${DIR_MIRACUM}/miracum_pipe.sh ${opt_args}\" of docker miracumpipe:${PIPELINE_VERSION}"
echo "---"
docker run -it --name run-miracum-pipeline_${PARAM_DIR_PATIENT} --rm ${TMP_RAM} ${VOLUME_CONF} \
-u $(id -u $USER) \
-v "$(pwd)/assets/input:${DIR_MIRACUM}/assets/input" \
-v "$(pwd)/assets/output:${DIR_MIRACUM}/assets/output" \
-v "$(pwd)/assets/references:${DIR_MIRACUM}/assets/references" \
-v "$(pwd)/tools/annovar:${DIR_MIRACUM}/tools/annovar" \
-v "$(pwd)/tools/gatk:${DIR_MIRACUM}/tools/gatk" \
-v "$(pwd)/tools/gatk4:${DIR_MIRACUM}/tools/gatk4" \
-v "$(pwd)/tools/fusioncatcher/data:${DIR_MIRACUM}/tools/fusioncatcher/data" \
-v "$(pwd)/databases:${DIR_MIRACUM}/databases" ${PARAM_DOCKER_REPO_NAME}:"${PIPELINE_VERSION}" "${DIR_MIRACUM}/miracum_pipe.sh" ${opt_args}
# for running behind a proxy use this commad and fill in your proxy
#docker run -it --env http_proxy="http://proxy.ibsm.uni-freiburg.de:8080" --env https_proxy="http://proxy.ibsm.uni-freiburg.de:8080" --name run-miracum-pipeline --rm ${TMP_RAM} ${VOLUME_CONF} \
# -u $(id -u $USER) \
# -v "$(pwd)/assets/input:${DIR_MIRACUM}/assets/input" \
# -v "$(pwd)/assets/output:${DIR_MIRACUM}/assets/output" \
# -v "$(pwd)/assets/references:${DIR_MIRACUM}/assets/references" \
# -v "$(pwd)/tools/annovar:${DIR_MIRACUM}/tools/annovar" \
# -v "$(pwd)/tools/gatk:${DIR_MIRACUM}/tools/gatk" \
# -v "$(pwd)/tools/gatk4:${DIR_MIRACUM}/tools/gatk4" \
# -v "$(pwd)/tools/fusioncatcher/data:${DIR_MIRACUM}/tools/fusioncatcher/data" \
# -v "$(pwd)/databases:${DIR_MIRACUM}/databases" ${PARAM_DOCKER_REPO_NAME}:"${PIPELINE_VERSION}" "${DIR_MIRACUM}/miracum_pipe.sh" ${opt_args}