1
|
1 #!/bin/sh
|
|
2
|
|
3 DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
4 source $DIR/rtg-galaxy.cfg
|
|
5
|
|
6 # Temporary storage for STDERR
|
|
7 # Temporary storage for mapping output
|
|
8 TMP_STDERR=$(mktemp) || exit 1
|
|
9
|
|
10 #echo "$(date) START $@" >>~/galaxy-rtg-wrapper.log
|
|
11
|
|
12 outputfile=$1
|
|
13 shift
|
|
14 outputid=$1
|
|
15 shift
|
|
16 outputdir=$1
|
|
17 shift
|
|
18 outputfilename=$1
|
|
19 shift
|
|
20
|
|
21 # Run the program, send STDERR to temporary file
|
|
22 tmpout=$outputdir/tmpout$$
|
|
23 $rtg "$@" -o $tmpout 2> $TMP_STDERR
|
|
24
|
|
25 #check program's exit code
|
|
26 if (( $? )); then
|
|
27 #echo "$(date) FAIL $@" >>~/galaxy-rtg-wrapper.log
|
|
28 #cat $TMP_STDERR >>~/galaxy-rtg-wrapper.log
|
|
29 #Program failed, send STDERR to real STDERR
|
|
30 cat $TMP_STDERR >&2
|
|
31 rm $TMP_STDERR
|
|
32 rm -rf $tmpout
|
|
33 exit 1
|
|
34 fi
|
|
35
|
|
36 mv $tmpout/$outputfilename $outputfile
|
|
37
|
|
38 #echo "$(date) DONE $@" >>~/galaxy-rtg-wrapper.log
|
|
39
|
|
40 #Program succeeded, delete STDERR file
|
|
41 rm $TMP_STDERR
|
|
42 rm -rf $tmpout
|
|
43 exit 0
|