#!/bin/csh
# SEARCH - a c-shell script 
# SEARCH searches GenBank using fasta
# $1 is a FILESET containing the DNA sequence to search for
# $2 is a FILESET containing the GenBank divisions (3-letter code)
#    you wish to be searched.

setenv testseq     $1:r 
set div =   (`cat $2`)

foreach token ($div)

   if (-e $GB/gb$token.ind) then
      set NAMESET = $token
   else
      set index = 1
      set NAMESET = ()
      while (-e $GB/gb$token$index.wrp)
            set NAMESET = ($NAMESET $token$index)
            @ index++
            end # while
   endif 

   foreach name ($NAMESET)
     nice fasta3$THREADED $1 $GB/gb$name.wrp -k -o3 -Q > $testseq.$name.fasta
   end

end