35
|
1 #!/bin/bash
|
|
2 random_hash=`tr -dc "[:alpha:]" < /dev/urandom | head -c 8`
|
|
3 Rscript --no-save $(dirname $(readlink -f $0))/RnBeadsGalaxy.R $* > /tmp/rnbeads_${random_hash}.stdout 2>/tmp/rnbeads_${random_hash}.stderr
|
|
4 #Rscript --no-save \$R_SCRIPTS_PATH/RnBeadsGalaxy.R $*
|
|
5 outfile=`echo $* | cut -d\ -f2 | sed -e "s/--output-file=//g"`
|
|
6 echo $outfile
|
|
7 #outdir=`echo $* | sed -e "s/.*--report-dir=\(.*\)[[:blank:]].*/\1/g"`
|
|
8
|
|
9
|
|
10 errl=`cat /tmp/rnbeads.stderr | grep -e "[E|e]rror" | wc -l`
|
|
11 if [ "$errl" -gt 0 ]
|
|
12 then
|
|
13 cat /tmp/rnbeads.stdout >&2
|
|
14 #cat $outdir/analysis.log >&2
|
|
15 cat /tmp/rnbeads.stderr >&2
|
|
16 exit 3
|
|
17 else
|
|
18 echo "<html><body>" >> $outfile
|
|
19 echo "<a href=\"index.html\">RnBeads report</a>" >> $outfile
|
|
20 echo "<br/><br/>Output was generated during the execution:<br/>" >> $outfile
|
|
21 echo "<pre>" >> outfile
|
|
22 cat /tmp/rnbeads.stdout |sed -e "s/$/<br\/>/g" >> $outfile
|
|
23 echo "</pre>" >> outfile
|
|
24 echo "</p>" >> $outfile
|
|
25 echo "</body></html>" >> $outfile
|
|
26 exit 0
|
|
27 fi |