annotate rnbeads_galaxy_wrapper.sh @ 45:6b0981ab063e draft default tip

Uploaded
author pavlo-lutsik
date Thu, 14 Aug 2014 14:56:18 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
1 #!/bin/bash
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
2 random_hash=`date | md5sum | head -c10`
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
3 Rscript --no-save $(dirname $(readlink -f $0))/RnBeadsGalaxy.R $* > /tmp/rnbeads_${random_hash}.stdout 2>/tmp/rnbeads_${random_hash}.stderr
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
4 #Rscript --no-save \$R_SCRIPTS_PATH/RnBeadsGalaxy.R $*
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
5 outfile=`echo $* | cut -d\ -f2 | sed -e "s/--output-file=//g"`
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
6 echo $outfile
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
7 #outdir=`echo $* | sed -e "s/.*--report-dir=\(.*\)[[:blank:]].*/\1/g"`
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
8
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
9
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
10 errl=`cat /tmp/rnbeads_${random_hash}.stderr | grep -e "[E|e]rror" | wc -l`
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
11 started=`cat /tmp/rnbeads_${random_hash}.stdout | grep -e "STARTED RnBeads Pipeline" | wc -l`
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
12 if [ "$started" -lt 1 ]
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
13 then
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
14 cat /tmp/rnbeads_${random_hash}.stdout >&2
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
15 cat /tmp/rnbeads_${random_hash}.stderr >&2
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
16 exit 3
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
17 else
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
18 echo "<html><body>" >> $outfile
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
19 echo "<a href=\"index.html\">RnBeads report</a>" >> $outfile
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
20 echo "<br/><br/><h5>Output was generated during the execution:</h5><br/>" >> $outfile
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
21 echo "<pre>" >> outfile
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
22 cat /tmp/rnbeads_${random_hash}.stdout |sed -e "s/$/<br\/>/g" >> $outfile
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
23 echo "</pre>" >> outfile
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
24 echo "</p>" >> $outfile
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
25 echo "</body></html>" >> $outfile
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
26 exit 0
6b0981ab063e Uploaded
pavlo-lutsik
parents:
diff changeset
27 fi