From 8b7f336e8af5392a91f8b9ae1dfc1983ecc7d1c5 Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Tue, 5 Oct 2004 12:40:05 +0000
Subject: [PATCH] change to be able to run on deskpro

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@1913 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 etc/run_blastp | 29 +++++++++++++++++++++++------
 etc/run_fasta  | 24 ++++++++++++++++++++----
 2 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/etc/run_blastp b/etc/run_blastp
index 2ac573c1b..95a98a318 100755
--- a/etc/run_blastp
+++ b/etc/run_blastp
@@ -6,7 +6,7 @@
 # to customise this script see the function called run_one_prog below
 
 
-RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_blastp,v 1.1 2004-06-09 10:02:59 tjc Exp $"
+RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_blastp,v 1.2 2004-10-05 12:40:05 tjc Exp $"
 
 PROG=`echo $RCS_HEADER | sed 's/.*run_\(.*\),v.*/\1/'`
 
@@ -49,11 +49,28 @@ run_one_prog () {
 
     EXTRA_ARGS=
 
+    HOSTNAME=`hostname`
+    REMOTE=N
+
+    case $HOSTNAME in
+        deskpro*)
+          REMOTE=Y ;;
+        *)
+    esac
+
+    if [ $REMOTE = "Y" ]; then
+      WDIR=`pwd`
+      export WDIR
+      rsh babel "cd $WDIR; lsrun -R 'select[blast && mem > 500] rusage[r1m=1:mem=500]' -v \
+                           blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p blastp \
+                           $EXTRA_ARGS >! $OUTPUT_FILE"
+    else
     # add/change the flags to suit your site:
-    lsrun -R 'select[blast && mem > 500] rusage[r1m=1:mem=500]' -v \
-      blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p blastp \
-      $EXTRA_ARGS 2>&1 > $OUTPUT_FILE | 
-      tee ${PROG}_errors.new 1>&2
+      lsrun -R 'select[blast && mem > 500] rusage[r1m=1:mem=500]' -v \
+        blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p blastp \
+        $EXTRA_ARGS 2>&1 > $OUTPUT_FILE | 
+        tee ${PROG}_errors.new 1>&2
+    fi
 
     #### end of changes
 
@@ -78,7 +95,7 @@ if [ x$ONEFILE = x ]
 then
     for i in `cat $1`
     do
-        run_one_prog $i $i.out $EXPANDED_DATABASE
+      run_one_prog $i $i.out $EXPANDED_DATABASE
     done
 
 else
diff --git a/etc/run_fasta b/etc/run_fasta
index 50927e9de..d11e66936 100755
--- a/etc/run_fasta
+++ b/etc/run_fasta
@@ -6,7 +6,7 @@
 # to customise this script see the function called run_one_prog below
 
 
-RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_fasta,v 1.8 2004-07-21 15:16:45 tjc Exp $"
+RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_fasta,v 1.9 2004-10-05 12:39:52 tjc Exp $"
 
 PROG=`echo $RCS_HEADER | sed 's/.*run_\(.*\),v.*/\1/'`
 
@@ -145,11 +145,11 @@ while(my $inFile = <LIST_FILE>)
       $inFile = $inFile_tmp;
     }
   }
-  
+ 
   print BSUB "$EXEC -B -S -q -b 100 -H $inFile $database ktup 2 > $inFile\.out\n";
   print BSUB "gzip -9 $inFile\.out\n";
 }
-close BSUB or die "Could not submit job : $!";
+close BSUB or die "--Could not submit job : $!";
 close LIST_FILE;
 
 '
@@ -158,9 +158,25 @@ close LIST_FILE;
 
 chmod a+x $PROG.kill
 
+HOSTNAME=`hostname`
+REMOTE=N
+
+case $HOSTNAME in
+    deskpro*)
+      REMOTE=Y ;;
+    *)
+esac
+
 if [ x$ONEFILE = x ]
 then
-    perl -w -e "$PERL_PROG" "$1" "$EXPANDED_DATABASE" "$PWD"
+   if [ $REMOTE = "Y" ]; then
+      WDIR=`pwd`
+      export WDIR
+      CMD=`echo $PERL_PROG`
+      rsh babel "cd $WDIR; perl -w -e '$CMD' \"$1\" \"$EXPANDED_DATABASE\" \"$PWD\""
+   else
+      perl -w -e "$PERL_PROG" "$1" "$EXPANDED_DATABASE" "$PWD"
+   fi
 else
     run_one_prog $1 $2 $EXPANDED_DATABASE
 fi
-- 
GitLab