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 outputdir=$1
|
|
15 shift
|
|
16
|
|
17 # Run the program, send STDERR to temporary file
|
|
18 tmpout=$outputdir/tmpout$$
|
|
19 $rtg "$@" -Z -o $tmpout 2> $TMP_STDERR
|
|
20
|
|
21 #check program's exit code
|
|
22 if (( $? )); then
|
|
23 #echo "$(date) FAIL $@" >>~/galaxy-rtg-wrapper.log
|
|
24 #cat $TMP_STDERR >>~/galaxy-rtg-wrapper.log
|
|
25 #Program failed, send STDERR to real STDERR
|
|
26 cat $TMP_STDERR >&2
|
|
27 rm $TMP_STDERR
|
|
28 rm -rf $tmpout
|
|
29 exit 1
|
|
30 fi
|
|
31
|
|
32 mv $tmpout/alignments.txt $outputfile
|
|
33
|
|
34 #echo "$(date) DONE $@" >>~/galaxy-rtg-wrapper.log
|
|
35
|
|
36 #Program succeeded, delete STDERR file
|
|
37 rm $TMP_STDERR
|
|
38 rm -rf $tmpout
|
|
39 exit 0
|