#!/bin/csh
#	rpsblast.csh <seq file> <db> <evalue> <filter flag>
#	<db> = plus-psi|minus-psi|prints-psi
#	if <db> = blplus; go to $test directory
#
#echo 1=$1 2=$2 3=$3 4=$4
setenv BLASTFILTER /usr/local/filter
setenv NCBI /usr/local/blast
#setenv LD_LIBRARY_PATH /usr/lib:/usr/ucblib:/opt/local/lib
#
unalias cp
unalias rm

umask 006
chmod 660 $1
#	blast programs are intolerant of format deviations
./blimps-bin/fastaseqs $1 $1.fas >& /dev/null
if ($4 == 'T') then
   $BLASTFILTER/seg $1.fas -x > $1.imp
else
   cp $1.fas $1.imp
endif

if ($2 == "blplus" || $2 == "blminus" || $2 == "prints") then
#  $NCBI/rpsblast -i $1.imp -d ../impala/$2 -e $3 -z 0 -F $4
   $NCBI/rpsblast -i $1.imp -d ../impala/$2 -e $3 -z 0 
endif

rm $1 $1.fas $1.imp
#
exit(0)
