forked from medema-group/BiG-SCAPE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_bigscape
executable file
·59 lines (50 loc) · 1.42 KB
/
run_bigscape
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
#!/bin/bash
if [[ $# -eq 0 || $1 == "-h" || $1 == "--help" || $1 == "--version" ]]; then
docker run \
--detach=false \
--rm \
--user=$(id -u):$(id -g) \
docker-registry.wur.nl/medema-group/big-scape:1.1.2 \
$@
else
set -o errexit
set -o nounset
function realpath() {
echo $(readlink -f $1 2>/dev/null || python -c "import sys; import os; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" $1)
}
# handle input file
readonly INPUT_FILE=$(basename $1)
echo input ${INPUT_FILE}
readonly INPUT_DIR=$(dirname $(realpath $1))
shift
# handle output file
if [[ $# -eq 0 ]]; then
echo You must specify an output dir
exit 1;
else
readonly OUTPUT_FILE=$(basename $1)
echo output ${OUTPUT_FILE}
readonly OUTPUT_DIR=$(dirname $(realpath $1))
shift
fi
if [ ! -d ${OUTPUT_DIR} ]; then
mkdir ${OUTPUT_DIR}
fi
# Links within the container
readonly CONTAINER_SRC_DIR=/home/input
readonly CONTAINER_DST_DIR=/home/output
#if [ ${INPUT_FILE} ${OUTPUT_FILE} ]; then
if [ ! -z ${INPUT_FILE} ] && [ ! -z ${OUTPUT_FILE} ]; then
echo Running BiG-SCAPE
docker run \
--volume ${INPUT_DIR}:${CONTAINER_SRC_DIR}:ro \
--volume ${OUTPUT_DIR}:${CONTAINER_DST_DIR}:rw \
--detach=false \
--rm \
--user=$(id -u):$(id -g) \
docker-registry.wur.nl/medema-group/big-scape:1.1.2 \
-i ${CONTAINER_SRC_DIR}/${INPUT_FILE} \
-o ${CONTAINER_DST_DIR}/${OUTPUT_FILE}\
$@
fi
fi