run_bigscape 1.42 KB
Newer Older
1
2
#!/bin/bash

3
if [[ $# -eq 0 || $1 == "-h" || $1 == "--help" || $1 == "--version" ]]; then
4
5
6
7
	docker run \
	--detach=false \
	--rm \
	--user=$(id -u):$(id -g) \
8
	docker-registry.wur.nl/medema-group/big-scape:v1.1.2 \
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
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
47
		echo Running BiG-SCAPE
48
49
50
51
52
53
		docker run \
	    	--volume ${INPUT_DIR}:${CONTAINER_SRC_DIR}:ro \
	    	--volume ${OUTPUT_DIR}:${CONTAINER_DST_DIR}:rw \
	    	--detach=false \
	    	--rm \
	    	--user=$(id -u):$(id -g) \
54
	    	docker-registry.wur.nl/medema-group/big-scape:v1.0.1 \
55
56
57
58
59
	    	-i ${CONTAINER_SRC_DIR}/${INPUT_FILE} \
	    	-o ${CONTAINER_DST_DIR}/${OUTPUT_FILE}\
    		$@
	fi
fi