From b19c162e20dfc02467db28b7449d1e14417e0c99 Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Mon, 21 Feb 2005 11:54:10 +0000
Subject: [PATCH] generic version

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@2323 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 etc/run_blastn   |  29 ++---------
 etc/run_blastp   |  28 ++--------
 etc/run_blastx   |  29 ++---------
 etc/run_clustalx |  24 ++-------
 etc/run_fasta    | 132 ++++-------------------------------------------
 etc/run_fastx    |  24 ++-------
 6 files changed, 32 insertions(+), 234 deletions(-)

diff --git a/etc/run_blastn b/etc/run_blastn
index fdcaa65a6..513ff047a 100755
--- a/etc/run_blastn
+++ b/etc/run_blastn
@@ -6,7 +6,7 @@
 # to customise this script see the function called run_one_prog below
 
 
-RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_blastn,v 1.2 2004-10-05 13:59:39 tjc Exp $"
+RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_blastn,v 1.3 2005-02-21 11:42:46 tjc Exp $"
 
 PROG=`echo $RCS_HEADER | sed 's/.*run_\(.*\),v.*/\1/'`
 
@@ -50,30 +50,9 @@ run_one_prog () {
     EXTRA_ARGS=
 
     # add/change the flags to suit your site:
-
-    HOSTNAME=`hostname`
-    REMOTE=N
-    
-    case $HOSTNAME in
-        deskpro*)
-          REMOTE=Y ;;
-        *)
-    esac
-
-    if [ $REMOTE = "Y" ]; then
-      WDIR=`pwd`
-      export WDIR
-      rsh babel "cd $WDIR; lsrun -v blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p blastn \
-                 $EXTRA_ARGS >! $OUTPUT_FILE"
-    else
-      lsrun -v blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p blastn \
-        $EXTRA_ARGS 2>&1 > $OUTPUT_FILE |
-        tee ${PROG}_errors.new 1>&2
-    fi
-
-#   lsrun -v blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p blastn \
-#     $EXTRA_ARGS 2>&1 > $OUTPUT_FILE | 
-#     tee ${PROG}_errors.new 1>&2
+    nice -19 $EXEC -d $DATABASE -i $INPUT_FILE -p blastn \
+      $EXTRA_ARGS 2>&1 > $OUTPUT_FILE | 
+      tee ${PROG}_errors.new 1>&2
 
     #### end of changes
 
diff --git a/etc/run_blastp b/etc/run_blastp
index 95a98a318..853a249d3 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.2 2004-10-05 12:40:05 tjc Exp $"
+RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_blastp,v 1.3 2005-02-21 11:45:33 tjc Exp $"
 
 PROG=`echo $RCS_HEADER | sed 's/.*run_\(.*\),v.*/\1/'`
 
@@ -49,28 +49,10 @@ 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
-    fi
+    nice -19 $EXEC -d $DATABASE -i $INPUT_FILE -p blastp \
+      $EXTRA_ARGS 2>&1 > $OUTPUT_FILE | 
+      tee ${PROG}_errors.new 1>&2
 
     #### end of changes
 
@@ -95,7 +77,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_blastx b/etc/run_blastx
index 700f09f3b..4172bfbad 100755
--- a/etc/run_blastx
+++ b/etc/run_blastx
@@ -6,7 +6,7 @@
 # to customise this script see the function called run_one_prog below
 
 
-RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_blastx,v 1.2 2004-10-05 14:53:49 tjc Exp $"
+RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_blastx,v 1.3 2005-02-21 11:46:53 tjc Exp $"
 
 PROG=`echo $RCS_HEADER | sed 's/.*run_\(.*\),v.*/\1/'`
 
@@ -50,30 +50,9 @@ run_one_prog () {
     EXTRA_ARGS=
 
     # add/change the flags to suit your site:
-
-    HOSTNAME=`hostname`
-    REMOTE=N
-
-    case $HOSTNAME in
-        deskpro*)
-          REMOTE=Y ;;
-        *)
-    esac
-
-    if [ $REMOTE = "Y" ]; then
-      WDIR=`pwd`
-      export WDIR
-      rsh babel "cd $WDIR; lsrun -v blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p blastx \
-                            $EXTRA_ARGS >! $OUTPUT_FILE"
-    else
-      lsrun -v blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p blastx \
-          $EXTRA_ARGS 2>&1 > $OUTPUT_FILE |
-          tee ${PROG}_errors.new 1>&2
-    fi
-
-#   lsrun -v blastwrap.pl $EXEC -d $DATABASE -i $INPUT_FILE -p blastx \
-#     $EXTRA_ARGS 2>&1 > $OUTPUT_FILE | 
-#     tee ${PROG}_errors.new 1>&2
+    nice -19 $EXEC -d $DATABASE -i $INPUT_FILE -p blastx \
+      $EXTRA_ARGS 2>&1 > $OUTPUT_FILE | 
+      tee ${PROG}_errors.new 1>&2
 
     #### end of changes
 
diff --git a/etc/run_clustalx b/etc/run_clustalx
index f7b5a603a..0b9dd6a12 100755
--- a/etc/run_clustalx
+++ b/etc/run_clustalx
@@ -4,7 +4,7 @@
 # contents of files listed in a file of filenames
 
 
-RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_clustalx,v 1.2 2004-10-05 15:21:47 tjc Exp $"
+RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_clustalx,v 1.3 2005-02-21 11:50:01 tjc Exp $"
 
 PROG=`echo $RCS_HEADER | sed 's/.*run_\(.*\),v.*/\1/'`
 
@@ -21,7 +21,7 @@ chmod a+x $PROG.kill
 file_of_filenames=$1
 date=`date +"%y_%m_%d"`
 hostname=`hostname`
-temp_file_name=clustalx/artemis_temp.$$.$hostname.$date.clustalx_input.fasta
+temp_file_name=/tmp/artemis_temp.$$.$hostname.$date.clustalx_input.fasta
 
 cat $file_of_filenames | xargs cat > $temp_file_name
 
@@ -36,24 +36,6 @@ perl -pne 'if (/^>(\S+)/) {
   }
 }' $temp_file_name > $temp_file_name.processed
 
-# delete it at some point
-echo "rm -f $temp_file_name* > /dev/null 2>&1" | at now + 8 hours
-
-HOSTNAME=`hostname`
-REMOTE=N
-
-case $HOSTNAME in
-    deskpro*)
-      REMOTE=Y ;;
-    *)
-esac
-
-if [ $REMOTE = "Y" ]; then
-  WDIR=`pwd`
-  export WDIR
-  ssh babel "cd $WDIR; clustalx $temp_file_name.processed"
-else
-  clustalx $temp_file_name.processed
-fi
+clustalx $temp_file_name.processed
 
 exit 0
diff --git a/etc/run_fasta b/etc/run_fasta
index 6e4f9b95c..31147c37b 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.11 2005-01-14 14:24:40 tjc Exp $"
+RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_fasta,v 1.12 2005-02-21 11:51:32 tjc Exp $"
 
 PROG=`echo $RCS_HEADER | sed 's/.*run_\(.*\),v.*/\1/'`
 
@@ -28,30 +28,10 @@ else
 fi
 
 
-#
-# Exchange DB name for fasta reference
-#
-if [ "$DATABASE" = "%uniprot" ]; then
-  DATABASE="%U";
-elif [ "$DATABASE" = "%uniprot_archaea" ]; then
-  DATABASE="%A";
-elif [ "$DATABASE" = "%uniprot_bacteria" ]; then
-  DATABASE="%B";
-elif [ "$DATABASE" = "%uniprot_eukaryota" ]; then
-  DATABASE="%E";
-elif [ "$DATABASE" = "%uniprot_viruses" ]; then
-  DATABASE="%V";
-elif [ "$DATABASE" = "%uniprot_rest" ]; then
-  DATABASE="%R";
-elif [ "$DATABASE" = "%malaria" ]; then
-  DATABASE="%M";
-elif [ "$DATABASE" = "%kineto_aa" ]; then
-  DATABASE="%K";
-fi
-
 # expand any ~ or environment variables
 EXPANDED_DATABASE=`echo "echo $DATABASE" | /bin/csh -f`
 
+
 ### change this function to suit your site:
 
 run_one_prog () {
@@ -59,41 +39,21 @@ run_one_prog () {
     OUTPUT_FILE=$2
     DATABASE=$3
 
-### strip out directory from command line
 
-    IN=`echo $INPUT_FILE | sed -n -e "s|$PWD//||p"`
- 
-    if test "$IN" != "" && test -f $IN; then
-      INPUT_FILE="$IN"
-    fi
-   
-    echo "\n\nIN=$IN\nPWD=$PWD\nINPUT_FILE=$INPUT_FILE\n\n"
     ### change these lines:
 
-    ### get sequence size
-    seq_size=`infoseq "$INPUT_FILE" -length -only -auto | awk '{ sum += $1 } END { print sum }`
-
-    FASTLIBS=/nfs/disk222/yeastpub/bio-soft/fasta/pubseqgbs export FASTLIBS
-    EXEC=/nfs/disk222/yeastpub/bio-soft/fasta/fasta33_t
+    EXEC=fasta34
 
     echo "about to start $EXEC with input from $INPUT_FILE and output to" 1>&2
     echo "$OUTPUT_FILE using database $DATABASE" 1>&2
 
     # add/change the flags to suit your site:
-    COMMAND="$EXEC -B -S -q -b 100 -H $INPUT_FILE $DATABASE ktup 2"
+    COMMAND="$EXEC -B -S -q -b 40 -H $INPUT_FILE $DATABASE ktup 2"
 
     echo "command line: $COMMAND" 1>&2
 
-#    lsrun -R 'select[blast && mem > 500] rusage[r1m=1:mem=500]' -v $COMMAND 2>&1 > $OUTPUT_FILE | 
-
-     if [ "$seq_size" -lt 50000 ]
-     then
-       bsub -q normal -n 1 -R 'select[blast && mem > 500] rusage[r1m=1:mem=500]' -I $COMMAND 2>&1 > $OUTPUT_FILE |
-         tee ${PROG}_errors.new 1>&2
-     else
-       bsub -q "longblastq" -n 1 -R 'select[blast && mem > 500] rusage[r1m=1:mem=500]' -I $COMMAND 2>&1 > $OUTPUT_FILE |
-         tee ${PROG}_errors.new 1>&2
-     fi
+    nice -19 $COMMAND 2>&1 > $OUTPUT_FILE | 
+      tee ${PROG}_errors.new 1>&2
 
     #### end of changes
 
@@ -110,87 +70,17 @@ run_one_prog () {
     fi
 }
 
-PERL_PROG='
-
-local *BSUB;
-
-my $file     = $ARGV[0];
-my $database = $ARGV[1];
-my $pwd      = $ARGV[2];
-chomp $file;
-chomp $database;
-
-$ENV{'FASTLIBS'} = "/nfs/disk222/yeastpub/bio-soft/fasta/pubseqgbs_test";
-
-
-open(BSUB, "| bsub -q normal -o fasta_errors -n 1 -R \"select[blast && mem > 500] rusage[r1m=1:mem=500]\" -K") or die "could not open bsub pipe : $!";
-open(LIST_FILE,$file);
-
-$EXEC="/nfs/disk222/yeastpub/bio-soft/fasta/fasta33_t";
-
-while(my $inFile = <LIST_FILE>)
-{
-  chomp($inFile);
-
-  if($inFile =~ m/^($pwd)(.*)/)
-  {
-    my $inFile_tmp = $2;
-    while($inFile_tmp =~ m/^(\/)(.*)/)
-    {
-      $inFile_tmp = $2;
-    }
-
-    if( -e $inFile_tmp )
-    {
-      $inFile = $inFile_tmp;
-    }
-  }
- 
-  if($inFile =~ m/^(\S{100})/)
-  {
-    if($inFile =~ m/^(\S{90,})(fasta\/\S+)/)
-    {
-      my $inFile_tmp = $1;
-
-      if( -e $inFile_tmp )
-      {
-        print BSUB "cd $inFile_tmp\n";
-        $inFile = $2;
-      }
-    }
-  }
-
-  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 LIST_FILE;
-
-'
-
 (echo "#!/bin/sh -"; echo "kill $$") > $PROG.kill
 
 chmod a+x $PROG.kill
 
-HOSTNAME=`hostname`
-REMOTE=N
-
-case $HOSTNAME in
-    deskpro*)
-      REMOTE=Y ;;
-    *)
-esac
-
 if [ x$ONEFILE = x ]
 then
-   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
+    for i in `cat $1`
+    do
+        run_one_prog $i $i.out $EXPANDED_DATABASE
+    done
+
 else
     run_one_prog $1 $2 $EXPANDED_DATABASE
 fi
diff --git a/etc/run_fastx b/etc/run_fastx
index 833c89690..e37d4b4cd 100644
--- a/etc/run_fastx
+++ b/etc/run_fastx
@@ -6,7 +6,7 @@
 # to customise this script see the function called run_one_prog below
 
 
-RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_fastx,v 1.2 2004-10-05 15:43:08 tjc Exp $"
+RCS_HEADER="$Header: //tmp/pathsoft/artemis/etc/run_fastx,v 1.3 2005-02-21 11:54:10 tjc Exp $"
 
 PROG=`echo $RCS_HEADER | sed 's/.*run_\(.*\),v.*/\1/'`
 
@@ -49,26 +49,12 @@ run_one_prog () {
     echo "$OUTPUT_FILE using database $DATABASE" 1>&2
 
     # add/change the flags to suit your site:
-    HOSTNAME=`hostname`
-    REMOTE=N
-
-    case $HOSTNAME in
-        deskpro*)
-          REMOTE=Y ;;
-        *)
-    esac
-
     COMMAND="$EXEC -B -S -q -b 40 -H $INPUT_FILE $DATABASE ktup 2"
-    echo "command line: $COMMAND" 1>&2    
 
-    if [ $REMOTE = "Y" ]; then
-      WDIR=`pwd`
-      export WDIR
-      rsh babel "cd $WDIR; $COMMAND >! $OUTPUT_FILE"
-    else
-      $COMMAND 2>&1 > $OUTPUT_FILE | 
-        tee ${PROG}_errors.new 1>&2
-    fi
+    echo "command line: $COMMAND" 1>&2
+
+    $COMMAND 2>&1 > $OUTPUT_FILE | 
+      tee ${PROG}_errors.new 1>&2
 
     #### end of changes
 
-- 
GitLab