#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  mailfasta mailfasta.doc mailfasta.changes getentry cid.c
# Wrapped by deboer@bio.vu.nl on Thu Jul 15 12:31:36 1993
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'mailfasta' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mailfasta'\"
else
echo shar: Extracting \"'mailfasta'\" \(24545 characters\)
sed "s/^X//" >'mailfasta' <<'END_OF_FILE'
X#!/bin/csh
X# ** MAILFASTA 3.2 **
X# Change the MAIL variables below, if your routing is different.
X# These settings are for sites connected to the Internet.
X#
X# Change the readseq alias according to local setup.
X# Readseq can be obtained by ftp from ftp.bio.indiana.edu
X# in directory molbio/readseq
X
X# alias readseq readseq
X
X# Use of readseq and some new messages added by 
X# Martti Tolvanen, U of Helsinki, Finland, 29 February 1992
X
X#**************************************************************************
X#
X# You can define your GRAIL user ID as a global variable GRAIL_ID.
X# put this line in your .cshrc :
X#          setenv GRAIL_ID your_grail_user_id
X# without the # sign
X
X# You can also define your name, adres and email adres in the same way
X#          setenv NAME_2D "Your name"
X#          setenv ADRES_2D "Your adres"
X#          setenv EMAIL_2D "Your email"
X#This is used in the 2D prediction server at EMBL
X#
X#**************************************************************************
X# test makes testing easier.
X# If test set to nothing, then normal operation.
X# else use test as mail address.
X
X#set test = deboer@bio.vu.nl
Xset test = ''
X
Xif ($test == '') then
X  set MAIL_BLAST = blast@ncbi.nlm.nih.gov
X  set MAIL_FASTA = fasta@embl-heidelberg.de
X  set MAIL_BLOCKS = blocks@howard.fhcrc.org
X  set MAIL_GRAIL = grail@ornl.gov
X  set MAIL_GENEID = geneid@darwin.bu.edu
X  set MAIL_PYTHIA = pythia@anl.gov
X  set MAIL_PREDICT = predictprotein@embl-heidelberg.de
X  set MAIL_BLITZ = blitz@embl-heidelberg.de
Xelse
X  set MAIL_BLAST = $test
X  set MAIL_FASTA = $test
X  set MAIL_BLOCKS = $test
X  set MAIL_GRAIL = $test
X  set MAIL_GENEID = $test
X  set MAIL_PYTHIA = $test
X  set MAIL_PREDICT = $test
X  set MAIL_BLITZ = $test
Xendif
X
Xset db1 = (GenBank GenBank-new EMBL EMBL-new EMBL-primate EMBL-rodent EMBL-mammal EMBL-vertebrate EMBL-invertebrate EMBL-plant EMBL-organelle EMBL-bacteria EMBL-fungi EMBL-viral EMBL-phage EMBL-synthetic EMBL-unannotated Non-redundant-DNA GenBank GenBank-new GB-vector EMBL EMBL-new EST Non-redundant-PROTEIN Swiss-Prot)
Xset db2 = (PIR GenPept GenPept-new TFD Swiss-Prot_All Swiss-Prot-New PIR PIR-Only Swiss-Prot_+_PIR Blocks Grail GeneID Pythia_rep Pythia_alu Kabat-DNA ALU-AA Kabat-AA Predict_2D Eukaryotic_promotor Swiss-Prot-new PDB PDB BLITZ_Swiss-Prot GenBank-Only GenBank_+_EMBL GenBank_+_EMBL-New PDB NRL)
Xset db = ($db1 $db2)
Xset db1 = (GBALL GBNEW EMALL EMNEW EPRI EROD EMAM EVRT EINV EPLN EORG EPRO EFUN EVRL EPHG ESYN EUNA nr genbank gbupdate vector embl emblu dbest)
Xset db2 = ( nr swissprot pir genpept gpupdate tfd SWALL SWNEW NBRF PIRONLY SWISSPIRALL blocks grail geneid pythia_rep pythia_alu kabatnuc palu kabatpro predict_2d epd spupdate pdb pdb BLITZ-SP GBONLY GENEMBL GENEW BROOKHAVEN NRL)
Xset dbreal = ($db1 $db2)
Xif ("$1" == '') then
X  echo ' '
X  echo '                                 MailFasta'
X  echo '                                 *********'
X  echo By Thon de Boer
X  echo Department of Microbiological Physiology
X  echo Vrije universiteit AMSTERDAM  Holland.
X  echo This program is in the Public Domain
X  echo 'Send comments to deboer@bio.vu.nl'
X  echo 'Version 3.2    July, 11 1993'
X  echo ' '
X  echo 'Usage : mailfasta [-d # sequencefile | sequencefile1 sequencefile2 ...]'
X  echo '         # = Number of service to be used'
X  echo 'This program will read a sequence file using readseq and mail it to'
X  echo "the different email servers for FASTA, BLAST, BLITZ, BLOCKS, GRAIL, GeneID"
X  echo ' and Pythia searches'
X  echo ' '
Xendif
X
Xset stop = false
Xwhile ($stop == false)
X
Xset choice2 = ''
Xif ("$1" == '') then
X   set argument = empty
Xelse
X   switch ("$1")
X    case -d:
X      if ("$2" == '') then
X         echo 'mailfasta : Missing servicenumber and sequencfile'
X         echo 'Usage : mailfasta [-d # sequencefile | sequencefile1 sequencefile2 ...]'
X         echo '         # = Number of service to be used'
X         exit
X      else
X         set choice2 = $2
X         shift
X         shift
X         if ("$1" == '') then
X            echo 'mailfasta: Missing sequencefile'
X            echo 'Usage : mailfasta [-d # sequencefile | sequencefile1 sequencefile2 ...]'
X            echo '         # = Number of service to be used'
X            exit
X         endif
X      endif
X      breaksw
X   case -*:
X      echo "mailfasta : Unknown option '$1'"
X      echo 'Usage : mailfasta [-d # sequencefile | sequencefile1 sequencefile2 ...]'
X      echo '         # = Number of service to be used'
X      exit
X      breaksw
X   endsw
X   set argument = $1
Xendif
X
Xif ($argument == empty) then
Xset good=false
Xwhile ($good == false)
Xecho -n 'Enter the filename wich contains the sequence: '
Xset file=$<
Xif ($file != '') then
X  if !(-f $file) then
X    echo mailfasta: File \'$file\' does not exist
X  else
X    echo ''
X    more -10 $file
X    echo ' '
X    echo -n 'Is this the right file ? ([yes]/no) '
X    set answer = $<
X    switch ($answer)
X    case n*:
X         breaksw
X    default:
X         set good=true
X         breaksw
X    endsw
X  endif
Xendif
Xend
X
Xelse if !(-f $argument) then
X  echo mailfasta: File \'$argument\' does not exist
X  exit
Xelse
X  set file = $argument
Xendif   # of if ($argument==empty)...
X
Xset filename = $file
Xreadseq $file -l -p > /tmp/mflist$$
Xif (-z /tmp/mflist$$) then
X  /bin/rm /tmp/mflist$$
X  echo Unknown format of file: $file
X  exit
Xendif
X
Xset nseq=`grep ')' /tmp/mflist$$ | wc -l` 
Xset iseq=1
Xif ($nseq > 2) then  # $nseq is not parsing as digits !
X  if ($choice2 == '') then
X  echo ''
X  cat /tmp/mflist$$
X  echo -n 'Choose query sequence by number: '
X  set iseq=$<
X  else
X     echo "mailfasta : can't handle multiple sequence files in non-interactive mode"
X     exit
X  endif
Xendif
X
X/bin/rm -f /tmp/mflist$$
X
Xreadseq $file -p -f8 -i$iseq > /tmp/mfseq$$
Xset file=/tmp/mfseq$$
X
Xif {(cid < $file)} then
X      set type = DNA
X    else
X      set type = PROTEIN
X    endif
X
Xif ($choice2 == '') then
X  more -5 $file
X  echo ""
X  echo -n "Sequence looks like $type. OK? ([yes]/no): " 
X   set answer = $<
X   switch ($answer)
X      case n*:
X           if ($type == DNA) then
X               set type = PROTEIN
X           else
X	       set type = DNA
X           endif
X           breaksw
X      default:
X           breaksw
X      endsw
Xendif
X 
Xendif
X
Xset loop = true
Xwhile ($loop == true)
Xif ($choice2 == '') then
X  echo ' '
X  echo '***** Now using' $type file: $filename
X  grep '>' $file
X  echo ' '
X  echo 'Which service(s) do you want to use ?'
X#  echo ''
X  echo 'FASTA search'
X  if ($type == DNA) then
X   echo '   1 GB              2 GB New          3 EMBL            4 EMBL New'
X   echo '  50 GB Only        51 GB + EMBL      52 GB + EMBL New'
X   echo '  EMBL sequence subdivisions (for faster searching)'
X   echo '   5 Primate         6 Rodent          7 Mammal          8 Vertebrate'
X   echo '   9 Invertebrate   10 Plant          11 Organelle      12 Bacterial'
X   echo '  13 Fungi          14 Viral          15 Phage          16 Synthetic'
X   echo '  17 Unanotated'
X   echo ''
X   echo 'BLAST search DNA'
X  else
X   echo '  31 Sw-Prot All    32 Sw-Prot New    33 PIR            34 PIR Only'
X   echo '  35 Sw-Prot + PIR  53 PDB (3D)       54 NRL (3D)'
X   echo ''
X   echo 'BLAST search DNA (protein query vs. 6 frames translated database)'
X  endif
X   echo "  18 All db's       19 GB             20 New GB         21 GB vector"
X   echo '  22 EMBL           23 New EMBL       24 EST            41 Kabat'
X   echo '  45 EPD            47 PDB'
X  if ($type == DNA) then
X   echo 'BLAST search PROTEIN (All 6 frames against protein database)'
X  else
X   echo 'BLAST search PROTEIN'
X  endif
X   echo "  25 all db's       26 SWISS-PROT     46 SWISS-PROT New 27 PIR"
X   echo '  28 GenPept        29 New GenPept    30 TFD            42 Alu'
X   echo '  43 Kabat          48 PDB'
X   echo ''
X   echo 'Other services'
X  if ($type == DNA) then
X   echo '  36 BLOCKS         37 GRAIL          38 GeneID/netgene'
X   echo '  39 Pythia repeats 40 Pythia Alu'
X  else
X   echo '  36 BLOCKS         44 Predict 2D     49 BLITZ (Sw-Prot)'
X  endif
X  echo ''
Xendif
X
Xset good=false
Xwhile ($good == false)
X  set blast = false
X  set fasta = false
X  set blocks = false
X  set grail = false
X  set geneid = false
X  set pythia = false
X  set predict = false
X  set blitz = false
X  set error = false
X  if ($choice2 == '') then
X    echo  -n 'Enter the number(s) of your choice (separated by a <SPACE>) : '
X    set choice=$<
X  else
X    set choice = $choice2
X  endif
X  set blastx=true
X  foreach i ($choice)
X  if ($type == DNA) then
X    switch($i)
X    case [1-9]:
X    case 10:
X    case 11:
X    case 12:
X    case 13:
X    case 14:
X    case 15:
X    case 16:
X    case 17:
X    case 50:
X    case 51:
X    case 52:
X           if ($error == false) then
X            set good = true
X            set fasta = true
X           endif
X           breaksw
X    case 18:
X    case 19:
X    case 20:
X    case 21:
X    case 22:
X    case 23:
X    case 24:
X    case 41:
X    case 45:
X    case 47:
X           if ($error == false) then
X            set good = true
X            set blast = true
X            set blastx = false
X           endif
X           breaksw
X    case 25:
X    case 26:
X    case 27:
X    case 28:
X    case 29:
X    case 30:
X    case 42:
X    case 43:
X    case 46:
X    case 48:
X           if ($error == false) then
X            set good = true
X            set blast = true
X           endif
X           breaksw
X     case 36:
X           if ($error == false) then
X              set good = true
X              set blocks = true
X           endif
X           breaksw
X     case 37:
X           if ($error == false) then
X              set good = true
X              set grail = true
X           endif
X           breaksw
X     case 38:
X           if ($error == false) then
X              set good = true
X              set geneid = true
X           endif
X           breaksw
X     case 39:
X     case 40:
X           if ($error == false) then
X              set good = true
X              set pythia = true
X           endif
X           breaksw
X     default:
X         echo mailfasta: Invalid choice \'$i\'
X         set good = false
X         set error = true
X         breaksw
X    endsw
X  else
X   switch ($i)
X   case 31:
X   case 32:
X   case 33:
X   case 34:
X   case 35:
X   case 53:
X   case 54:
X          if ($error == false) then
X           set good = true 
X           set fasta = true
X          endif
X          breaksw
X   case 18:
X   case 19:
X   case 20:
X   case 21:
X   case 22:
X   case 23:
X   case 24:
X   case 41:
X   case 25:
X   case 26:
X   case 27:
X   case 28:
X   case 29:
X   case 30:
X   case 42:
X   case 43:
X   case 45:
X   case 46:
X   case 47:
X   case 48:
X         if ($error == false) then
X          set good = true
X          set blast = true
X          set blastx = false
X         endif
X         breaksw
X   case 36:
X         if ($error == false) then
X          set good = true
X          set blocks = true
X         endif
X         breaksw
X   case 44:
X         if ($error == false) then
X          set good = true
X          set predict = true
X         endif
X         breaksw
X   case 49:
X         if ($error == false) then
X            set good = true
X            set blitz = true
X         endif
X         breaksw
X   default:
X         echo mailfasta: Invalid choice \'$i\'
X         set good = false
X         set error = true
X         breaksw
X   endsw
X  endif
Xend #foreach i ($choice)
Xif (($error == true)&&($choice2 != '')) exit
Xend #while ($good == flase)
X
Xif ($choice2 == '') then
X
Xif ($fasta == true) then
X echo ''
X echo 'Enter parameters for the FASTA search'
X set good = false
X while ($good == false)
X  echo '  Enter the sensitivity (= ktup, lower number means more sensitive)'
X  if ($type == DNA) then
X    echo -n '   (3..6) [4]: '
X  else
X    echo -n '   (1..2) [1]: '
X  endif
X  set ktup=$<
X  if ($ktup != '') then
X    if ($type == DNA) then
X      switch ($ktup)
X      case [3-6]:
X         set good = true
X         breaksw
X      default:
X         echo mailfasta: Invalid choice \'$ktup\'
X         breaksw
X      endsw
X    else
X      switch ($ktup)
X      case [1-2]:
X         set good = true
X         breaksw
X      default:
X         echo mailfasta: Invalid choice \'$ktup\'
X         breaksw
X      endsw
X    endif
X  else
X    if ($type == DNA) then
X      set ktup=4
X    else
X     set ktup=1
X    endif
X    set good = true
X  endif
X end
X echo -n '  Enter the number of matched sequences to be listed [100]: '
X set scores=$<
X if ($scores == '') set scores=100
X echo -n '  Enter the number of aligned sequences to be listed (0-30) [10]: '
X set align=$<
X if ($align == '') set align=10
Xelse
X set ktup=''
Xendif
X
Xif ($blast == true) then
X   echo ''
X   echo 'Enter parameters for the BLAST search'
X   echo -n '  Enter the expectation cutoff value (0 - 1000) [10]: '
X   set expect=$<
X   if ($expect == '') set expect = 10
X   echo -n '  Enter the cutoff value (optional): '
X   set cutoff=$<
X   echo -n '  Enter the number of matched sequences to be listed [50]: '
X   set blast_scores=$<
X   if ($blast_scores == '') set blast_scores=50
X   echo -n '  Enter the number of aligned sequences to be listed [20]: '
X   set blast_align=$<
X   if ($blast_align == '') set blast_align=20
X   if ($blastx == false) then
X    echo -n '  Do you want the histogram ? yes/[no]: '
X    set histogram=$<
X    switch ($histogram)
X     case y*:
X     case Y*:
X           set histogram = yes
X           breaksw
X     default:
X           set histogram = no
X    endsw
X   else
X    set histogram = ''
X   endif
Xendif
X
Xif ($grail == true) then
X   if ($?GRAIL_ID == '0') then
X    echo ''
X    echo 'ORF predicting using the GRAIL service'
X    echo -n '   Enter your GRAIL user ID: '
X    set GRAIL_ID = $<
X    if ($GRAIL_ID != '') then
X      set good = true
X    else
X      echo ''
X      echo "GRAIL needs your GRAIL ID number, if you don't have one"
X      echo ' you can apply for one now'
X      echo ''
X      echo -n ' Do you want to apply for a GRAIL user ID ? [yes]/no: '
X      set input=$<
X      switch ($input)
X       case n*:
X       case N*:
X            echo ''
X            echo 'OK..Sequence will NOT be submitted to the GRAIL service'
X            set grail = false
X            breaksw
X       default:
X            echo -n 'Enter your name: '
X            set name = $<
X            echo -n 'Enter your address: '
X            set address = $<
X            echo -n 'Enter your phone number: '
X            set phone = $<
X            echo -n 'Enter your eMail address: '
X            set email = $<
X            echo Register > /tmp/mf2$$
X            echo $name >> /tmp/mf2$$
X            echo $address >> /tmp/mf2$$
X            echo $phone >> /tmp/mf2$$
X            echo $email >> /tmp/mf2$$
X            mail $MAIL_GRAIL < /tmp/mf2$$
X            /bin/rm /tmp/mf2$$
X            echo 'Your request has been sent to GRAIL.'
X            echo 'A email message with the ID number will be sent to you very soon now.'
X            set grail = false
X            breaksw
X       endsw
X    endif
X   endif
Xendif
X
Xif ($geneid == true) then
X   echo ''
X   echo 'ORF predicting using the GeneID service'
X   echo -n '   Would you also like to use the NETGENE service ? [yes]/no: '
X   set NETGENE = $<
X   switch ($NETGENE)
X    case n*:
X    case N*:
X      set NETGENE = false
X      breaksw
X    default:
X      set NETGENE = true
X      breaksw
X   endsw
Xendif
X
Xif ($predict == true ) then
X   if (($?NAME_2D == '0')||($?ADRES_2D == '0')||($?EMAIL_2D == '0')) then
X      echo ''
X      echo 'Prediction of 2D structure'
X      echo '  This server needs your name, adres and email adres'
X      echo '   (You can define the global variables, NAME_2D, ADRES_2D and EMAIL_2D,'
X      echo '   to contain your name, adres and email adres)'
X      echo -n '   Enter your name : '
X      set NAME_2D = $<
X      echo -n '   Enter your adres : '
X      set ADRES_2D = $<
X      echo -n '   Enter your email adres : '
X      set EMAIL_2D = $<
X   endif
Xendif
X
Xif ($blitz == true) then
X   echo ''
X   echo 'Enter the parameters for the BLITZ search'
X   echo -n '  Which PAM-Matrix would you like to use ? (1-500) [120]: '
X   set blitz_pam = $<
X   if ($blitz_pam == '') set blitz_pam = 120
X   echo -n '  Enter the gap penalty (5-30 depends on PAM): '
X   set blitz_gap = $<
X   echo -n '  Enter the number of best matching sequences to be listed (0-100) [50]: '
X   set blitz_scores = $<
X   if ($blitz_scores == '') set blitz_scores = 50
X   echo -n '  Enter the number of aligned sequences to be listed (1-100) [30]: '
X   set blitz_align = $<
X   if ($blitz_align == '') set blitz_align = 30
Xendif
X
Xecho ''
Xecho "|"
Xecho "+--=> You have selected $type file '$filename'"
Xecho '      to be used with the following parameters:'
X
Xif ($fasta == true) then
X   echo ''
X   echo 'FASTA search:'
X   echo '  KTUP value: '$ktup
X   echo '  Number of matched sequences to be listed: '$scores
X   echo '  Number of aligned sequences to be listed: '$align
X   echo '  Databank sections to be searched :'
X   foreach j ($choice)
X     switch ($j)
X      case [1-9]:
X      case 10:
X      case 11:
X      case 12:
X      case 13:
X      case 14:
X      case 15:
X      case 16:
X      case 17:
X      case 31:
X      case 32:
X      case 33:
X      case 34:
X      case 35:
X      case 50:
X      case 51:
X      case 52:
X      case 53:
X      case 54:
X             echo '    '$db[$j]
X             breaksw
X     endsw
X   end
Xendif
X
Xif ($blast == true) then
X  echo ''
X  echo BLAST search:
X  echo '  Expectation cutoff: '$expect
X  if ($cutoff != '') echo '  Cutoff value: '$cutoff
X  echo '  Maximum number of matched sequences: '$blast_scores
X  echo '  Maximum number of aligned sequences: '$blast_align
X  if ($blastx == false) echo '  Listing of histogram: '$histogram
X  echo '  Databank sections to be searched :'
X  foreach j ($choice)
X   switch ($j)
X     case 18:
X     case 19:
X     case 20:
X     case 21:
X     case 22:
X     case 23:
X     case 24:
X     case 41:
X     case 45:
X     case 47:
X            if ($type == PROTEIN) then
X               echo '    All 6 readingframes of DNA database: '$db[$j]
X            else
X               echo '    '$db[$j]
X            endif
X            breaksw
X     case 25:
X     case 26:
X     case 27:
X     case 28:
X     case 29:
X     case 30:
X     case 42:
X     case 43:
X     case 46:
X     case 48:
X            if ($type == DNA) then
X               echo '    6 readingframes of the query against PROTEIN database: '$db[$j]
X            else
X               echo '    '$db[$j]
X            endif
X            breaksw
X   endsw
X  end
Xendif
X
Xif ($blocks == true) then
X   echo ''
X   echo 'Homology searching using the BLOCKS server'
Xendif
X
Xif ($grail == true) then
X   echo ''
X   echo 'ORF predicting using the GRAIL service'
X   echo '  using user ID : '$GRAIL_ID
Xendif
X
Xif ($geneid == true) then
X   echo ''
X   echo 'ORF predicting using the GeneID service'
X   if ($NETGENE == true) echo ' plus the NETGENE service'
Xendif
X
Xif ($pythia == true) then
X   echo ''
X   foreach j ($choice)
X    switch ($j)
X      case 39:
X           echo 'Indentifying repetitive elements in Human DNA using the Pythia service'
X           breaksw
X      case 40:
X           echo 'Identifying Alu subfamily membership using the Pythia service'
X           breaksw
X    endsw
X   end
Xendif
X
Xif ($predict == true) then
X   echo ''
X   echo 'Protein 2D structure prediction'
X   echo '  using name : '$NAME_2D
X   echo '       adres : '$ADRES_2D
X   echo '       email : '$EMAIL_2D
Xendif
X
Xif ($blitz == true) then
X   echo ''
X   echo 'Homology searching using the BLITZ service'
X   echo '  PAM matrix : '$blitz_pam
X   if ($blitz_gap != '') echo '  Gap penalty : '$blitz_gap
X   echo '  Number of best matching sequences : '$blitz_scores
X   echo '  Number of aligned sequences : '$blitz_align
Xendif
X
Xecho ''
Xecho -n 'Is this OK? [yes]/no/exit: '
Xset dummy=$<
Xecho ' '
Xswitch ($dummy)
X case n*:
X case N*:
X       breaksw
X case e*:
X case E*:
X       /bin/rm $file
X       exit
X       breaksw
X default:
X set loop = false
Xendsw
X
Xendif # if ($choice2 ...
Xif ($choice2 != '') set loop = false
X
Xif ($loop == false) then
X foreach i ($choice)
X switch ($i)
X    case 18:
X    case 19:
X    case 20:
X    case 21:
X    case 22:
X    case 23:
X    case 24:
X    case 41:
X    case 25:
X    case 26:
X    case 27:
X    case 28:
X    case 29:
X    case 30:
X    case 42:
X    case 43:
X    case 45:
X    case 46:
X    case 47:
X    case 48:
X           set blastx = false
X           if (($i == 25)||($i == 26)||($i == 27)||($i == 28)||($i == 29)||($i == 30)||($i == 42)||($i == 43)||($i == 46)||($i == 48)) then
X            if ($type == PROTEIN) then
X              echo PROGRAM blastp > /tmp/mf$$
X            else
X              echo PROGRAM blastx > /tmp/mf$$
X              set blastx = true
X            endif
X           else
X            if ($type == DNA) then
X              echo PROGRAM blastn > /tmp/mf$$
X            else
X              echo PROGRAM tblastn > /tmp/mf$$
X            endif
X           endif
X           echo DATALIB $dbreal[$i] >> /tmp/mf$$
X           if ($choice2 == '') then
X             echo DESCRIPTION $blast_scores >> /tmp/mf$$
X             echo ALIGNMENTS $blast_align >> /tmp/mf$$
X             if ($blastx == false) echo HISTOGRAM $histogram >> /tmp/mf$$
X             echo EXPECT $expect >> /tmp/mf$$
X             if ($cutoff != '') echo CUTOFF $cutoff >> /tmp/mf$$
X           endif
X           echo BEGIN >> /tmp/mf$$
X           cat /tmp/mf$$ $file | mail $MAIL_BLAST
X           if ($choice2 == '') echo Now mailing $filename for BLAST search in section \'$db[$i]\' to NCBI
X           breaksw
X     case 37:
X         if ($grail == true) then
X           echo Sequences 1 $GRAIL_ID > /tmp/mf$$
X           cat $file >> /tmp/mf$$
X           mail $MAIL_GRAIL < /tmp/mf$$
X           if ($choice2 == '') echo Now mailing $filename for ORF predicting using the GRAIL service
X         else
X          echo ' ' > /tmp/mf$$     #Create dummy file to avoid error for rm
X         endif
X         breaksw
X     case 38:
X           echo Genomic Sequence > /tmp/mf$$
X           if ($choice2 == '') then
X              if ($NETGENE == true) echo NetGene >> /tmp/mf$$
X           else
X              echo NetGene >> /tmp/mf$$
X           endif
X           cat $file >> /tmp/mf$$
X           mail $MAIL_GENEID < /tmp/mf$$
X           if ($choice2 == '') echo Now mailing $filename for ORF predicting using the GeneID service
X           breaksw
X     case 36:
X           cat $file > /tmp/mf$$
X           mail $MAIL_BLOCKS < /tmp/mf$$
X           if ($choice2 == '') echo Now mailing $filename for homology searching using the BLOCKS service
X           breaksw
X     case 39:
X           readseq -f1 -p /tmp/mfseq$$ | tr '[a-z]' '[A-Z]' | mail -s rpts $MAIL_PYTHIA
X           if ($choice2 == '') echo Now mailing $filename for identification of repetitive elements using the Pythia service
X           breaksw
X     case 40:
X           readseq -f1 -p /tmp/mfseq$$ | tr '[a-z]' '[A-Z]' | mail -s alu $MAIL_PYTHIA
X           if ($choice2 == '') echo Now mailing $filename for identification of Alu subfamily membership using the Pythia service
X           breaksw
X     
X     case 44:
X           echo $NAME_2D > /tmp/mf$$
X           echo $ADRES_2D >> /tmp/mf$$
X           echo $EMAIL_2D >> /tmp/mf$$
X           echo '#'$filename >> /tmp/mf$$
X           grep -v '>' $file >> /tmp/mf$$
X           mail -s $filename $MAIL_PREDICT < /tmp/mf$$
X           echo Now mailing $filename for 2D structure prediction to EMBL
X           breaksw
X      case 49:
X           echo PAM $blitz_pam > /tmp/mf$$
X           if ($blitz_gap != '') echo INDEL $blitz_gap >> /tmp/mf$$
X           echo LIST $blitz_scores >> /tmp/mf$$
X           echo ALIGN $blitz_align >> /tmp/mf$$
X           echo TITLE $filename >> /tmp/mf$$
X           echo SEQ >> /tmp/mf$$
X           grep -v '>' $file >> /tmp/mf$$
X           echo END >> /tmp/mf$$
X           mail -s $filename $MAIL_BLITZ < /tmp/mf$$
X           echo Now mailing $filename for BLITZ homology search to EMBL
X           breaksw
X      default:
X           echo LIB $dbreal[$i] > /tmp/mf$$
X           if ($ktup != '') echo WORD $ktup >> /tmp/mf$$
X           echo LIST $scores >> /tmp/mf$$
X           echo ALIGN $align >> /tmp/mf$$
X           echo TITLE $filename >> /tmp/mf$$
X           echo SEQ >> /tmp/mf$$
X           grep -v '>' $file >> /tmp/mf$$
X           echo END >> /tmp/mf$$
X           mail -s $filename $MAIL_FASTA < /tmp/mf$$
X           echo Now mailing $filename for a FASTA search to EMBL
X           breaksw
X  endsw
X  if (-f /tmp/mf$$) /bin/rm /tmp/mf$$
Xend # foreach i
X/bin/rm /tmp/mfseq$$
Xendif
Xend #while ($loop == true)
X
Xif ("$2" == '') then
X  set stop = true
Xelse
X  shift
X  if ($choice2 == '') then
X    echo ' '
X    echo '-+-+-+- next file -+-+-+-'
X  endif
Xendif
Xend
Xif ($choice2 == '') then
X  echo ''
X  date
X  echo Search results will be returned by e-mail shortly.
Xendif
END_OF_FILE
if test 24545 -ne `wc -c <'mailfasta'`; then
    echo shar: \"'mailfasta'\" unpacked with wrong size!
fi
chmod +x 'mailfasta'
# end of 'mailfasta'
fi
if test -f 'mailfasta.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mailfasta.doc'\"
else
echo shar: Extracting \"'mailfasta.doc'\" \(10208 characters\)
sed "s/^X//" >'mailfasta.doc' <<'END_OF_FILE'
XMAILFASTA and GETENTRY
X
XNAME
X     mailfasta - send a sequence file for comparison with sequence databases
X                 or for ORF predicting
X     getentry - get an entry from the sequence databases
X
XSYNOPSIS
X     mailfasta [-d # sequencefile | sequencefile1 sequencefile2 ...]
X               # = Number of service to be used
X
X     getentry database entry1 [entry2 ...]
X
XDESCRIPTION
X   
X     MAILFASTA 3.2
X    
X     The EMBL site in Germany and the NCBI site in US contain several sequence
X     databases. A sequence can be compared with these databases by sending
X     a specially formatted email message to the sites mail-server.
X     On the sites the sequence is compared to the databases with the FASTA and
X     MPsrch program (EMBL) or the BLAST program (NCBI) and the results will be
X     e-mailed back.
X     The Pythia site in the US contains two small databases, which contain 
X     Human repetitive elements. These databases can also be compared against
X     the sequence query.
X
X     There are two other mailservers which will take a DNA sequence and
X     try to predict exon-intron splice sites and gene organisation. These
X     are GRAIL and GeneID.
X
X     Another way to find homology in sequences is to compare it with a 
X     database of blocks of AA sequences derived from the PROSITE database.
X     This can be done with the BLOCKS mailserver. DNA sequences will be
X     translated in the 6 reading frames and a BLOCKS search will be done on
X     those 6 AA sequences.
X
X     The PredictProtein mailserver at the EMBL can give some insight in the
X     secondary structure of the AA sequence query. It will produce a multiple
X     sequence alignment if it finds a block of homologous proteins from the
X     Swiss-Prot database.
X     
X     
X     Mailfasta is a (csh) program which reads a sequence file and sends a 
X     specially formatted email message to the different email servers, where
X     it will be processed and the results are emailed back.
X     The program can operate in interactive and in default mode. In interactive
X     mode the user will be prompted for all the settings to be used. In the 
X     default mode (option -d), only the service and one sequence file is given
X     and the sequence will be processed with the default setting of the
X     requested service. In default mode it's 'no questions asked'.
X     The number of the service to be used can be found in the interactive mode.
X     In interactive mode, more than one sequencfile can be given and it will
X     prompt for all the sequences given, one at the time.
X     
X     The sequence file(s) can have several formats. File containing more than
X     one sequence can also be used, but only in the interactive mode.
X     The program readseq is used to translated all the different formats.
X     This program MUST be present and is not a part of the mailfasta package.
X     It can be obtained via anonymous ftp from several sources
X     (for instance : ftp.bio.indiana.edu::/molbio/readseq)
X
X     The ORF predicting GRAIL server can only be used if a valid user id
X     is given. If you don't have a GRAIL user id you can aply for one in
X     the program. It will ask you for your name and address and will sent
X     your request to GRAIL. GRAIL will provide you with the userid via email.
X     If you do have a GRAIL userid, you can make a global variable 
X     GRAIL_USERID by adding this line to your .cshrc file :
X     setenv GRAIL_ID your_grail_user_id
X     but you can also enter it when it asks you for one.
X
X     The PredictProtein server needs a name, adres and email adres. You can
X     define the global variables NAME_2D, ADRES_2D and EMAIL_2D in your .cshrc
X     file, to contain your name, adres and email adres. (Use double quotes if
X     they contain spaces). If you have not defined (one of the global)
X     variables, it will ask you for the data.
X
X     The program will check whether the sequence is DNA or PROTEIN, simply
X     by counting the percentage of the bases G, A, T and C. For this, a small
X     c program is used, called cid.c. This program comes with the program.
X     It must be present and compiled to 'cid'. The shar file will compile it.
X     If you did not use the shar file to install 'mailfasta' you will have
X     to compile it yourself, by using the command 'cc -o cid cid.c'.
X
X
X     GETENTRY
X    
X     Entries of interest can be obtained with the program getentry.
X     entry is the locus name which can be found in the FASTA or BLAST output.
X     The entries will be e-mailed back.
X     A entry from the BLOCKS database can be retrieved by sending a email
X     to blocks@howard.fhcrc.org with the block number in the subject line.
X
X     GOPHER is a much better way to retrieve sequences from databases. I
X     strongly recommend everybody to use GOPHER. Ask your local network guru
X     for more information on GOPHER.
X
XDATABASES
X     FASTA searches are sent to the EMBL site in Germany. There the sequence
X     can be compared to the GenBank and EMBL DNA database and the Swiss-Prot,
X     PIR and PDB AA databases. It is also possible to compare DNA sequences
X     to subsets of the EMBL database.
X     BLITZ searches of the Swiss-Prot database are also sent to EMBL.
X     
X     BLAST searches are sent to the NCBI server in the US. There the sequence
X     can be compared to GenBank, GenBank Update, EMBL, EMBL Update, Vector
X     subset of GB, Expressed Sequence Tags (EST), Eukaryotic promotor database
X     (EPD), Swiss-Prot, Swiss-Prot Update, PIR, GenPept, Transcription Factor
X     Database (TFD), Kabat (sequences of immunological interest), Alu (Human
X     repetitive elements) and sequences in the Brookhaven 3D structure DB.
X     If a AA database is chosen for a DNA sequence, the sequence will be
X     translated in the 6 reading frames and the resulting AA sequences will be
X     compared to the AA databases. If a DNA database is chosen for a AA 
X     sequence, the database will be translated in the 6 reading frames and
X     the AA sequences will be compared to the translated DNA database.
X
XHELP
X     Help or more information on interpreting the results can be obtained
X     by sending HELP in an email message to the following adresses :
X
X     FASTA : fasta@embl-heidelberg.de
X     BLAST : blast@ncbi.nlm.nih.gov
X     BLOCKS : blocks@howard.fhcrc.org
X     GRAIL : grail@ornl.gov
X     GENEID : geneid@darwin.bu.edu
X     PYTHIA : pythia@anl.gov
X     Predict 2D structure : predictprotein@embl-heidelberg.de
X     BLITZ : blitz@embl-heidelberg.de
X
X     RETRIEVE : retrieve@ncbi.nlm.nih.gov (getentry)
X
XBUGS
X     you tell me :-)
X
XFILES
X     cid                A c program which checks if a file is a DNA sequence
X                        or a protein sequence. If a file contains more than
X                        85% A, C, G and T's it is considered to be a DNA file.
X                        This file MUST be present and compiled from cid.c.
X     readseq            A file conversion program. Must be present.
X                        Program can be obtained via anonymous ftp 
X                        from fly.bio.indiana.edu.
X     mailfasta.doc      This documentation
X     mailfasta.changes  Changes since the last version (starting at 3.0)
X     /tmp/mflist$$
X     /tmp/mfseq$$
X     /tmp/mf$$          Temporary storage of the email message.
X     /tmp/ge$$          Temporary storage for getentry
X
X     
XCHANGES SINCE THE LAST VERSIONS
X
XVersion 3.2 (July 11, 1993)
X     * The EMBL FASTA server has returned to this version. It has replaced the
X         FASTA server in Japan. The respons time of the server at EMBL in
X         Germany is much shorter now and it has a wider range of databases to
X         be searched.
X     * The BLITZ server at EMBL has been added.
X         This service runs the MPsrch program of Shane Sturrock and John Collins
X         Edinburgh, UK.  It performs extrememly fast "best local similarity"
X         searches of the Swiss-Prot protein sequence database, using the well
X         known Smith and Waterman algorithm.
X     * The PDB database has been added to the databases to be searched using
X         the BLAST server at NCBI
X
XVersion 3.1 (February 18, 1993)
X     * Two new servers have been added :
X         Pythia (Human repetitive DNA and ALU subfamily membership)
X         Predict 2D structure of a AA sequence
X     * Three new databases have been added to the BLAST search :
X         Alu (Human repetitive elements)
X         Kabat (Sequences of immunological interest)
X         Swiss-Prot Update (Cumulative weekly update)
X     * Option -d has been added. If option -d is used, mailfasta operates in
X     the default mode. After -d one number and one sequenfile can be given.
X     The number is the number of the service to be used for the sequence file.
X     The sequence will be emailed to the requested service with the default
X     settings for that service. If there are no errors mailfasta will return
X     no messages.
X     The '-d sequencfile' part can be repeated several times. It is also
X     posible to give a sequencfilename after the '-d # file' part for normal
X     interactive mode. So :
X
X        mailfasta -d 18 file1 -d 1 file2 file3 file4 -d 13 file5
X
X     is possible.
X
XVersion 3.0 (August, 22 1992)
X     There have been a lot of changes since the last version of mailfasta (2.1)
X     Version 3.0 no longer uses the FASTA and BLAST server at the GenBank site
X     (genbank.bio.net) as those services will be terminated soon. Instead it
X     uses the FASTA server at the FLAT site in Japan. This site does not have
X     the vector subset, so this cannot be searched using the FASTA program.
X     Version 3.0 now uses the NCBI site with the BLAST program which can search
X     almost all DNA and PROTEIN databases.
X     It can also search a query for PROSITE blocks using the BLOCKS server.
X     ORF predicting is now possible using the GRAIL and GeneID/NetGene server.
X     Retrieving sequnce entries is no handled by the NCBI RETRIEVE server.
X     Getentry now needs a database name and a LOCUS name from that database to
X     be retrieved. A better way to retrieve sequence entries is to use the
X     gopher hole at iubio and the EMBNET hole in switserland.
X     
XLast change: February 18, 1993
END_OF_FILE
if test 10208 -ne `wc -c <'mailfasta.doc'`; then
    echo shar: \"'mailfasta.doc'\" unpacked with wrong size!
fi
# end of 'mailfasta.doc'
fi
if test -f 'mailfasta.changes' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mailfasta.changes'\"
else
echo shar: Extracting \"'mailfasta.changes'\" \(2813 characters\)
sed "s/^X//" >'mailfasta.changes' <<'END_OF_FILE'
XCHANGES SINCE THE LAST VERSION
X
XVersion 3.2 (July 11, 1993)
X     * The EMBL FASTA server has returned to this version. It has replaced the
X         FASTA server in Japan. The respons time of the server at EMBL in
X         Germany is much shorter now and it has a wider range of databases to
X         be searched.
X     * The BLITZ server at EMBL has been added. 
X         This service runs the MPsrch program of Shane Sturrock and John Collins
X         Edinburgh, UK.  It performs extrememly fast "best local similarity"
X         searches of the Swiss-Prot protein sequence database, using the well
X         known Smith and Waterman algorithm.
X     * The PDB database has been added to the databases to be searched using
X         the BLAST server at NCBI
X
XVersion 3.1 (February 18, 1993)
X     * Two new servers have been added :
X         Pythia (Human repetitive DNA and ALU subfamily membership)
X         Predict 2D structure of a AA sequence
X     * Three new databases have been added to the BLAST search :
X         Alu (Human repetitive elements)
X         Kabat (Sequences of immunological interest)
X         Swiss-Prot Update (Cumulative weekly update)
X     * Option -d has been added. If option -d is used, mailfasta operates in
X     the default mode. After -d one number and one sequenfile can be given.
X     The number is the number of the service to be used for the sequence file.
X     The sequence will be emailed to the requested service with the default
X     settings for that service. If there are no errors mailfasta will return
X     no messages.
X     The '-d sequencfile' part can be repeated several times. It is also
X     posible to give a sequencfilename after the '-d # file' part for normal
X     interactive mode. So :
X
X        mailfasta -d 18 file1 -d 1 file2 file3 file4 -d 13 file5
X
X     is possible.
X
XVersion 3.0 (August, 22 1992)
X     There have been a lot of changes since the last version of mailfasta (2.1)
X     Version 3.0 no longer uses the FASTA and BLAST server at the GenBank site
X     (genbank.bio.net) as those services will be terminated soon. Instead it
X     uses the FASTA server at the FLAT site in Japan. This site does not have
X     the vector subset, so this cannot be searched using the FASTA program.
X     Version 3.0 now uses the NCBI site with the BLAST program which can search
X     almost all DNA and PROTEIN databases.
X     It can also search a query for PROSITE blocks using the BLOCKS server.
X     ORF predicting is now possible using the GRAIL and GeneID/NetGene server.
X     Retrieving sequence entries is no handled by the NCBI RETRIEVE server.
X     Getentry now needs a database name and a LOCUS name from that database to
X     be retrieved. A better way to retrieve sequence entries is to use the
X     gopher hole at iubio and the EMBNET hole in switserland.
END_OF_FILE
if test 2813 -ne `wc -c <'mailfasta.changes'`; then
    echo shar: \"'mailfasta.changes'\" unpacked with wrong size!
fi
# end of 'mailfasta.changes'
fi
if test -f 'getentry' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'getentry'\"
else
echo shar: Extracting \"'getentry'\" \(2352 characters\)
sed "s/^X//" >'getentry' <<'END_OF_FILE'
X#!/bin/csh
X# RETRIEVE_NCBI = adress of retrieve mailserver of Genbank.
X# Change if routing for your site is different.
Xset RETRIEVE_NCBI = retrieve@ncbi.nlm.nih.gov
X
Xif ($1 != '') then
X    set datalib = $1
X    shift
X    switch ($datalib)
X      case gb:
X      case GB:
X      case genb*:
X      case GENB*:
X           set datalib = genbank
X           breaksw
X      case gbu*:
X      case GBU*:
X           set datalib = gbupdate
X           breaksw
X      case embl:
X      case EMBL:
X           set datalib = EMBL
X           breaksw
X      case emblu*:
X      case EMBLU*:
X           set datalib = emblupdate
X      case *est:
X      case *EST:
X           set datalib = dbest
X           breaksw
X      case s*:
X      case S*:
X           set datalib = swissprot
X           breaksw
X      case p*:
X      case P*:
X           set datalib = pir
X            breaksw
X      case gp:
X      case GP:
X      case genp*:
X      case GENP*:
X           set datalib = genpept
X           breaksw
X      case gpu*:
X      case GPU*:
X           set datalib = gpupdate
X           breaksw
X      case tfd:
X      case TFD:
X           set datalib = tfd
X           breaksw
X      case kabat*n*:
X      case KABAT*N*:
X           set datalib = kabatnuc
X           breaksw
X      case kabat*p*:
X      case KABAT*P*:
X           set datalib = kabatpro
X           breaksw
X      case v*:
X      case V*:
X           set datalib = vector
X           breaksw
X      default:
X           echo getentry: Unknown database \'$datalib\'
X           exit
X           breaksw
X    endsw
X
X    echo DATALIB $datalib > /tmp/ge$$
X    echo BEGIN >> /tmp/ge$$
X    set stop = false
X    while ($stop == false)
X      echo $1 >> /tmp/ge$$
X      shift
X      if ($1 == '') set stop = true
X    end
X    more /tmp/ge$$
X    echo ''
X    mail $RETRIEVE_NCBI < /tmp/ge$$
X    /bin/rm /tmp/ge$$
X    echo 'Entry request(s) mailed to NCBI'
X    echo Entries will appear in the mailbox in a few moments.
Xelse
X  echo getentry: Retrieve a sequence database entry via mail from NCBI
X  echo 'Usage: getentry database entry [entry entry ....]'
X  echo ' database is the name of database where entry is to be retrieved from'
X  echo ' and can be one of the following : genbank/gb, gbu[pdate], embl, emblu[pdate]'
X  echo ' s[wiss-prot], p[ir], genp[ept], gpu[pdate], tfd, kabatnuc, kabatpro, epd'
X  echo ' and v[ector]. Entry must be a locus name'
Xendif
END_OF_FILE
if test 2352 -ne `wc -c <'getentry'`; then
    echo shar: \"'getentry'\" unpacked with wrong size!
fi
chmod +x 'getentry'
# end of 'getentry'
fi
if test -f 'cid.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cid.c'\"
else
echo shar: Extracting \"'cid.c'\" \(573 characters\)
sed "s/^X//" >'cid.c' <<'END_OF_FILE'
X#include <stdio.h>
X
Xmain ()
X{
X int ca,cc,cg,ct,total,i,ch;
X float result;
X ca=cc=cg=ct=total=i=0;
X while((ch = getchar()) == ';') readln();
X if (ch =='>') readln();
X while((ch = getchar()) != EOF)
X { switch (ch)
X   { case 'a':
X     case 'A': ca++; break;
X     case 'c':
X     case 'C': cc++; break;
X     case 't':
X     case 'T': ct++; break;
X     case 'g':
X     case 'G': cg++; break;
X   }
X   if (((ch>=65)&&(ch<=90))||((ch>=97)&&(ch<=122))) total++;
X}
X result = (float)(ca+cc+ct+cg)/total;
X if (result>=.85) exit(0);
X else exit(1);
X}
X
Xreadln()
X{
X while(getchar() != 10);
X}
END_OF_FILE
if test 573 -ne `wc -c <'cid.c'`; then
    echo shar: \"'cid.c'\" unpacked with wrong size!
fi
# end of 'cid.c'
fi
echo shar: Now compiling cid.c into cid
cc -o cid cid.c
echo "I have unshared Mailfasta 3.2" | mail deboer@bio.vu.nl
echo shar: End of shell archive.
exit 0
