From: macrides@wfeb2.bitnet
Subject: GRAILSHELLS.SHARE
Organization: Worcester Fndn. for Exptl. Biol.
Date: 4 Sep 92 02:08:21 EDT


        GRAILSHELLS.SHARE is a VMS_SHARE set of Steve_Clark/Erik_Sonnhammer-
style command procedures for users of the Wisconsin GCG package to register
with the GRAIL (Gene Recognition and Analysis Internet Link) Email server, and
to send the server requests for GRAIL analyses.  Installation instructions are
included as comments at the tops of the files.  The *.HLP files can be
inserted in the GCG on-line help library.

Contents:

00README.TXT       -- This message.

REG_GRAIL.COM      -- For registration with the GRAIL server.
  REG_GRAIL.HLP

GRAIL.COM          -- For submission of GRAIL analysis protocols.
  GRAIL.HLP
  TOFASTA.FOR (Steve Clark's GCG to FastA format converter)
  TOFASTA.HLP

=========================================================================
 Foteos Macrides           Worcester Foundation for Experimental Biology
 MACRIDES@WFEB2.BITNET     222 Maple Avenue, Shrewsbury, MA 01545
=========================================================================

$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007  22-FEB-1990
$!   On  4-SEP-1992 01:38:22.79   By user MACRIDES (Foteos Macrides)
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. 00README.TXT;1
$!       2. GRAIL.COM;1
$!       3. GRAIL.HLP;1
$!       4. REG_GRAIL.COM;1
$!       5. REG_GRAIL.HLP;1
$!       6. TOFASTA.FOR;1
$!       7. TOFASTA.HLP;1
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
X`09GRAILSHELLS.SHARE is a VMS_SHARE set of Steve_Clark/Erik_Sonnhammer-
Xstyle command procedures for users of the Wisconsin GCG package to register
Xwith the GRAIL (Gene Recognition and Analysis Internet Link) Email server, a
Vnd
Xto send the server requests for GRAIL analyses.  Installation instructions a
Vre
Xincluded as comments at the tops of the files.  The *.HLP files can be
Xinserted in the GCG on-line help library.
X
XContents:
X
X00README.TXT       -- This message.
X
XREG_GRAIL.COM      -- For registration with the GRAIL server.
X  REG_GRAIL.HLP
X
XGRAIL.COM          -- For submission of GRAIL analysis protocols.
X  GRAIL.HLP
X  TOFASTA.FOR (Steve Clark's GCG to FastA format converter)
X  TOFASTA.HLP
X `20
X=========================================================================
X Foteos Macrides           Worcester Foundation for Experimental Biology
X MACRIDES@WFEB2.BITNET     222 Maple Avenue, Shrewsbury, MA 01545
X=========================================================================
$ CALL UNPACK 00README.TXT;1 705385329
$ create 'f'
X$ orig_veri = f$environment("VERIFY_PROCEDURE")
X$ v = f$verify(0) ! (Grail turns off verification)
X$!
X$!                              GRAIL.COM
X$!                              ---------
X$!
X$! Version 1.0
X$! Foteos Macrides (MACRIDES@WFEB2.BITNET), August 21, 1992
X$!
X$! Command procedure to Email a nucleic sequence for a GRAIL analysis.  This
X$! procedure asks all the relevant questions, constructs a text file with th
Ve
X$! sequence in GRAIL format, and mails it.  It accepts the name of the query
X$! sequence on the command line as P1, else prompts for it.
X$!
X$! Installation:
X$! -------------
X$! 1. The symbol GRAIL_ADDRESS below should be assigned the network address
X$!    for the GRAIL service. This may have to be changed to accomodate local
X$!    gateways, etc.
X$!
X$! 2. Compile and Link ToFastA.For in the GCG environment:
X$!`09$ GCGSUPPORT
X$!`09$ FORTRAN/EXTEND TOFASTA
X$!`09$ GENLINK TOFASTA
X$!
X$! 3. Assign symbols (in the appropriate initializing GCG command procedure)
V:
X$!`09$ TOFASTA :== $device:`5Bdirectory`5DTOFASTA
X$!`09$ GRAIL   :== $device:`5Bdirectory`5DGRAIL
X$!
X$! 4. REG_GRAIL.COM must be installed (see comments at top of that file) and
X$!    run by each user to register with the GRAIL service and get a user_id.
X$!    The user should then define the logical GRAIL_ID in his/her LOGIN.COM:
X$!`09$ DEFINE/NOLOG GRAIL_ID "user_id"
X$!
X$!--------------------------------------------------------------------------
V--
X$
X$`09on control_y then goto restore
X$`09bell`5B0,7`5D = 7
X$`09ws := "write sys$output"
X$`09iq := inquire/nopunctuation
X$
X$`09! The Internet address for sending the search file is
X$`09! grail@ornl.gov
X$
X$`09grail_address := """IN%"""""grail@ornl.gov""""""
X$
X$`09ws ""
X$`09ws "This procedure initiates a GRAIL analysis of protein coding"
X$`09ws "potential for your DNA query sequence.  The information required
X$`09ws "for executing the analysis is sent to the GRAIL server via"
X$`09ws "electronic mail.  The results of the analysis will be returned"
X$`09ws "to you via Email.  You must have a GRAIL user_id to use the"
X$`09ws "server (use REG_GRAIL to get one), and you must define the"
X$`09ws "logical GRAIL_ID to that user_id (in a case-sensitive manner)"
X$`09ws "in your LOGIN.COM to use this procedure."
X$
X$get_id:
X$
X$`09user_id := "''F$TRNLNM("GRAIL_ID")'"
X$`09if(user_id.NES."") then goto view_grail_help
X$`09ws ""
X$       ws "''bell'You have not defined the logical GRAIL_ID!"
X$`09ws ""
X$`09goto restore
X$
X$get_query:
X$
X$`09! Get query sequence if not specified as P1, so ToFastA won't
X$`09! issue its own prompt and confuse the user about what program
X$`09! is being used.
X$
X$`09ws ""
X$`09if(p1.EQS."") then iq p1 "GRAIL with what query sequence? "
X$`09if(p1.EQS."") then goto get_query
X$
X$`09! ToFastA prompts for the sequence name (if not specified on the
X$`09! command line) and the region to search. It does all the error
X$`09! checking and returns all the relevant info to this procedure via
X$`09! global symbols.
X$
X$`09assign/usermode tt: sys$input
X$`09ToFastA/seqinfo/noreverse 'p1'
X$`09if(seqinfotype.EQS."NONE") then Exit ! Error from within ToFastA
X$`09on control_y then goto terminate
X$`09seqlength = f$integer(seqinfoend) - f$integer(seqinfostart)
X$`09seqlength := 'f$string(seqlength)'
X$
X$`09! Check that the sequence is not a protein.
X$
X$`09if(seqinfotype.NES."PROTEIN") then goto check_short
X$`09ws ""
X$`09ws "''bell'''seqinfoiname' is a PROTEIN, not DNA!"
X$`09goto ask_what_to_do
X$
X$check_short:
X$
X$`09! Check that the sequence is at least 100 bases long
X$
X$`09if(f$integer(seqlength).GE.100) then goto check_long
X$`09ws ""
X$`09ws "''bell'Your query sequence is less than 100 bases long!"
X$`09ws "The GRAIL server will not accept such short sequences."
X$`09goto ask_what_to_do
X$
X$check_long:
X$
X$`09! Check that the sequence is not longer than 100kb
X$
X$`09if(f$integer(seqlength).le.100000) then goto do_it
X$`09ws ""
X$`09ws "''bell'Your query sequence is greater than 100 kilobases!"
X$`09ws "The GRAIL server will not accept such long sequences."
X$
X$ask_what_to_do:
X$
X$`09ws ""
X$`09ws "Select option by number:"
X$`09ws ""
X$`09ws "1) Specify another sequence"
X$`09ws "2) Quit"
X$`09ws ""
X$`09iq choice "Choice (* 1 *) ? "
X$`09IF(choice.EQS."2") then goto terminate
X$`09p1 := ""
X$`09delete/nolog 'seqinfooname';0
X$`09goto get_query
X$
X$do_it:
X$
X$`09! Write the text file that will be mailed to the server
X$
X$`09ws ""
X$`09ws "Creating the file to be mailed to the GRAIL server..."
X$
X$`09open/write outfile tmp$.tmp$
X$`09wc := "write outfile"
X$`09wc "Sequences 1 ''user_id'"
X$`09close outfile
X$`09convert/append 'seqinfooname' tmp$.tmp$
X$
X$`09! Mail the file away.
X$`09! GRAIL server doesn't acknowledge, so also mail to self.
X$
X$       ws ""
X$`09ws "The file ''outname' will be sent to the GRAIL server."
X$       ws "    The server does not mail an acknowledgment copy,"
X$`09ws "    so a self-copy will be mailed to you now."
X$       ws ""
X$`09ws "Mailing the file to you and the GRAIL server..."
X$
X$`09mail/noedit/self/subject="''seqinfooname'" tmp$.tmp$ 'grail_address'
X$
X$       ws ""
X$`09ws "The file ''seqinfooname' has been sent to you and the GRAIL"
X$`09ws "   server.  The results will be mailed back to you shortly."
X$`09ws ""
X$
X$terminate:
X$
X$`09if(f$search("''seqinfooname'").NES."") then -
X`09`09delete/nolog 'seqinfooname';0
X$`09if(f$search("tmp$.tmp$").NES."") then delete/nolog tmp$.tmp$;*
X$
X$restore:
X$
X$`09! Restore verification to the status quo ante
X$
X$       v = f$verify(orig_veri)
X$`09exit
$ CALL UNPACK GRAIL.COM;1 1781913257
$ create 'f'
X1 GRAIL
X     GRAIL initiates an analysis of protein coding potential of a DNA
X     sequence, performed on the GRAIL (Gene Recognition and Analysis
X     Internet Link) server at grail@ornl.gov.  The coding recognition
X     module (CRM) uses a multiple-sensor neural network approach to
X     identify coding exons than are at least 100 bases long.
X
X     Before using GRAIL, you must register with the server and get a
X     user_id.  Use REG_GRAIL to do this.  Upon receiving a user_id,
X     add the following line to your LOGIN.COM:
X                  $ DEFINE/NOLOG GRAIL_ID "user_id"
X     with the user_id entered in a case-sensitive manner, and bounded
X     by double-quotation marks.
X
X     GRAIL will ask you the appropriate questions, create an analysis
X     protocol, and Email it for you.  A copy of the protocol will also
X     be Emailed to you.  The server will Email you the results.
X
X     You must use a NUCLEOTIDE query sequence in a GCG formatted file.
X     GRAIL will reformat the sequence (or a designated portion of the
X     sequence) into native FastA (Pearson) format and insert that query
X     into the protocol.
X
X     When reading Email, use the EXTRACT command to make a copy of the
X     GRAIL results to your account:
X                  MAIL> EXTR/NOHEAD filename.ext
$ CALL UNPACK GRAIL.HLP;1 859069334
$ create 'f'
X$ orig_veri = f$environment("VERIFY_PROCEDURE")
X$ v = f$verify(0) ! (Reg_Grail turns off verification)
X$!
X$!                            REG_GRAIL.COM
X$!                            -------------
X$!
X$! Version 1.0
X$! Foteos Macrides (MACRIDES@WFEB2.BITNET), August 21, 1992
X$!
X$! Command procedure to Email a registration request to the GRAIL server.
X$! This procedure asks all the relevant questions, constructs a text file
X$! with the relevant info, and mails it.
X$!
X$! Installation:
X$! -------------
X$! 1. The symbol GRAIL_ADDRESS below should be assigned the network address
X$!    for the GRAIL service. This may have to be changed to accomodate local
X$!    gateways, etc.
X$!
X$! 2. The symbol REPLY_ADDRESS below should be assigned to your own system's
X$!    network address (e.g., WFEB2.bitnet).
X$!
X$! 3. Assign symbol (in the appropriate initializing GCG command procedure):
X$!`09$ REG_GRAIL :== $device:`5Bdirectory`5DREG_GRAIL
X$!
X$! 4. Upon running REG_GRAIL.COM and receiving a user_id, each user should
X$!    then define the logical GRAIL_ID in his/her LOGIN.COM:
X$!`09$ DEFINE/NOLOG GRAIL_ID "user_id"
X$!
X$!--------------------------------------------------------------------------
V--
X$
X$`09on control_y then goto restore
X$`09bell`5B0,7`5D = 7
X$`09ws := "write sys$output"
X$`09iq := inquire/nopunctuation
X$
X$`09! The Internet address for sending the registration file is
X$`09! grail@ornl.gov
X$
X$`09grail_address := """"IN%"""""grail@ornl.gov""""""
X$
X$
X$`09! The network address of your system should be entered within
X$`09! the double quotes.
X$
X$`09reply_address := ""
X$
X$`09IF(reply_address.EQS."")
X$`09 THEN
X$`09 ws ""
X$`09 ws "''bell'The network address of your system has not been defined."
X$`09 ws ""
X$`09 goto restore
X$`09ENDIF
X$
X$`09user_name := 'F$GETJPI("","USERNAME")'
X$`09email_address := "''user_name'@''reply_address'"
X$
X$`09ws ""
X$`09ws "This procedure creates and Emails a registration request to the"
X$`09ws "GRAIL server.  The server will Email a user_id and a description"
X$`09ws "of the GRAIL analysis to you.  Upon receiving a user_id, add the"
X$`09ws "following line to your LOGIN.COM:"
X$`09ws "       $ DEFINE/NOLOG GRAIL_ID ""user_id"""
X$`09ws "with the user_id entered in a case-sensitive manner, and bounded"
X$`09ws "by double-quotation marks."
X$`09ws ""
X$
X$get_full_name:
X$
X$`09ws ""
X$`09define/nolog/user sys$input sys$command
X$`09read/prompt="Enter your full name (case-sensitive): " -
X                     sys$input full_name
X$`09deassign/user sys$input
X$`09if(full_name.EQS."") then goto get_full_name
X$
X$get_postal_address:
X$
X$`09ws ""
X$`09ws "Enter your postal address on one line (80 character maximum):
X$`09define/nolog/user sys$input sys$command
X$`09read/prompt="" sys$input postal_address
X$`09deassign/user sys$input
X$`09if(postal_address.EQS."") then goto get_postal_address
X$`09if(f$length(postal_address).LE.80) then goto get_phone_number
X$`09ws ""
X$`09ws "''bell'You used more than 80 characters!"
X$`09goto get_postal_address
X$
X$get_phone_number:
X$
X$`09ws ""
X$`09define/nolog/user sys$input sys$command
X$`09read/prompt="Enter your phone (with area code): " -
X                     sys$input phone_number
X$`09deassign/user sys$input
X$`09if(phone_number.EQS."") then goto get_phone_number
X$
X$`09! Show registration information
X$
X$`09ws ""
X$`09ws ""
X$`09ws "The following registration information will be sent:"
X$`09ws ""
X$`09ws "''full_name'"
X$`09ws "''postal_address'"
X$`09ws "''phone_number'"
X$`09ws "''email_address'"
X$`09ws ""
X$`09iq choice "Is it all correct (* yes *)? "
X$`09choice = f$extract(0, 1, choice)
X$`09if(choice.EQS."") then goto do_it
X$`09if(choice.EQS."Y") then goto do_it
X$
X$ask_what_to_do:
X$
X$`09! Something is wrong. Give chance to start over or give up.
X$
X$`09ws ""
X$`09ws "Do you want to:"
X$`09ws ""
X$`09ws " 1) Start over"
X$`09ws " 2) Give up"
X$`09ws ""
X$`09iq choice "Please enter the number of your choice (* 1 *): "
X$`09if(choice.eqs."") then choice := "1"
X$`09if(choice.eqs."1") then goto get_full_name
X$`09if(choice.eqs."2") then goto restore
X$`09ws ""
X$`09ws "''bell'Valid responses are 1 - 2, inclusive."
X$`09goto ask_what_to_do
X$
X$do_it:
X$
X$`09! Write the text file that will be mailed to the server
X$
X$`09ws ""
X$`09ws "Creating the file to be mailed to the GRAIL server..."
X$
X$`09open/write outfile tmp$.tmp$
X$`09on control_y then goto terminate
X$`09wc := "write outfile"
X$`09wc "Register"
X$`09wc "''full_name'"
X$`09wc "''postal_address'"
X$`09wc "''phone_number'"
X$`09wc "''email_address'"
X$`09close outfile
X$
X$`09! Mail the file away.
X$
X$       ws ""
X$`09ws "Mailing the registration information to the GRAIL server..."
X$
X$`09mail/noedit/noself/subject="" tmp$.tmp$ 'grail_address'
X$
X$       ws ""
X$`09ws "The registration information has been sent to the GRAIL server."
X$`09ws "   A user_id will be mailed back to you shortly.  Remember to"
X$`09ws "   define it in your LOGIN.COM:"
X$`09ws "      $ DEFINE/NOLOG GRAIL_ID ""user_id"""
X$`09ws ""
X$
X$terminate:
X$
X$`09if(f$search("tmp$.tmp$").NES."") then delete/nolog tmp$.tmp$;0
X$
X$restore:
X$
X$`09! Restore verification to the status quo ante
X$
X$       v = f$verify(orig_veri)
X$`09exit
$ CALL UNPACK REG_GRAIL.COM;1 1300190112
$ create 'f'
X1 REG_GRAIL
X     REG_GRAIL creates and e-mails a registration request to the
X     GRAIL (Gene Recognition and Analysis Internet Link) server at
X     grail@ornl.gov.
X
X     The server will e-mail a user_id and a description of the GRAIL
X     analysis to you.  Upon receiving a user_id, add the following line
X     to your LOGIN.COM:
X                  $ DEFINE/NOLOG GRAIL_ID "user_id"
X     with the user_id entered in a case-sensitive manner, and bounded
X     by double-quotation marks.  This must be done before using GRAIL.
$ CALL UNPACK REG_GRAIL.HLP;1 521655515
$ create 'f'
X!***  TOFASTA ***********************************************************
X!*
X!* This program converts a standard GCG file sequence to FASTA format,
X!* as required by the GenBank BLAST server for database searching. With
X!* no command line switches, the program asks for the sequence filename,
X!* the regions to convert, and whether or not it should be reversed. The`20
X!* output filename is root.FASEQ.
X!*
X!* The following command line switches are available:
X!*
X!* /INfile = filename`09Suppresses the request for the input filename
X!* /NOREVerse`09`09Forces the top strand to be output
X!* /SEQINFO`09`09Sets symbols that can be used in command shells:
X!*`09`09SEQINFOINAME`09Input sequence filename
X!*`09`09SEQINFOONAME`09Output sequence filename
X!*`09`09SEQINFOTYPE`09"PROTEIN", "DNA", or "NONE" on error
X!*`09`09SEQINFOSTART
X!*`09`09SEQINFOEND
X!*`09`09SEQINFOLENGTH
X!*`09`09SEQINFOREV
X!*
X!* Written by Steve Clark September 7, 1991
X!*
X!* To install, initiate the GCG support environment with the command
X!* GCGSUPPORT, compile the program (FORTRAN/EXTEND TOFASTA) and link
X!* it (GENLINK TOFASTA).  Then define it as a foreign command:
X!*
X!* $ TOFASTA :== $device:`5Bdirectory`5DTOFASTA
X!*
X!*************************************************************************
X
X`09program tofasta
X
X`09implicit none
X
X`09integer infile, lseq, rpos, lpos, l, i
X`09integer inttostr, str_len, revseq, getstring
X
X`09character inname(256), outname(256), seq(100001), text(33)
X
X`09byte bytename(256)
X
X`09logical seqinfo, logstatus, reverse
X`09logical clnoarg, isprotein, dclsetsymbol, clgetoldfname
X
Xc Check for the command line switch /SEQINFO to see if the symbols should
Xc be set for using in a command shell.
X
X`09seqinfo = .false.
X`09if(clnoarg('SEQINFO')) then
X`09`09seqinfo = .true.
X`09`09logstatus = dclsetsymbol('seqinfotype', 'NONE')
X`09endif
X
X`09if(.not.seqinfo) then
X`09`09call writef(
X     & '\nTOFASTA converts a GCG format sequence to the native FastA format.
V\n')
X`09endif
X
Xc Look for the input filename on the command line. If not found, ask for it.
X
X`09if(.not.clgetoldfname('INfile', 1, inname)) then
X`09`09call writef('\nTOFASTA of what GCG sequence? ')
X`09`09if(getstring(inname).eq.0) stop ' '
X`09endif
X
Xc Open the file and read in the sequence.
X
X`09call openfile(infile, inname, 'rdb')
X`09call readseq(infile, seq, lseq)
X`09call closef(infile)
X
Xc Get the range and revere if not prevented by the command line argument.
X
X`09call getrange(lpos, rpos, lseq)
X`09reverse = .false.
X`09if(.not.clnoarg('NOREVERSE')) call getreverse(reverse)
X
Xc We have all the info we need. Calculate the output filename.
X
X`09call strcopy(outname, inname)
X`09call newfiletype(outname, '.faseq')
X
Xc Set the SEQINFO symbols if required.
X
X`09if(seqinfo) then
X`09`09logstatus = dclsetsymbol('seqinfoiname', inname)
X`09`09logstatus = dclsetsymbol('seqinfooname', outname)
X`09`09l = inttostr(lpos, text)
X`09`09logstatus = dclsetsymbol('seqinfostart', text)
X`09`09l = inttostr(rpos, text)
X`09`09logstatus = dclsetsymbol('seqinfoend', text)
X`09`09l = inttostr(lseq, text)
X`09`09logstatus = dclsetsymbol('seqinfolength', text)
X`09`09logstatus = dclsetsymbol('seqinforev', 'FALSE')
X`09`09if(reverse) logstatus = dclsetsymbol('seqinforev', 'TRUE')
X`09`09logstatus = dclsetsymbol('seqinfotype', 'DNA')
X`09`09if(isprotein(seq))
X     &`09`09`09logstatus = dclsetsymbol('seqinfotype', 'PROTEIN')
X`09endif
X
Xc Open the output file and write the first line which consists of a ">" and
Xc the sequence name. This is followed by a space and the region that was
Xc included in the conversion.
X
X`09l = str_len(outname)
X`09do i=1, l
X`09`09bytename(i) = ichar(outname(i))
X`09enddo
X`09open (unit=1, file=bytename, type='new', carriagecontrol='list')
X`09if(.not.reverse) then
X`09`09write(1,1010) (outname(i), i=1, l), lpos, rpos
X1010`09`09format('>', <l>a1, ' From', i6, ' to', i6)
X`09else
X`09`09write(1,1011) (outname(i), i=1, l), lpos, rpos
X1011`09`09format('>',<l>a1,' From',i6,' to',i6,' Reverse orientation')
X`09`09l = revseq(seq, lpos, rpos)
X`09endif
X
Xc Now write out the sequence, 70 characters to a line with no spaces.
X
X`09do while (lpos.le.rpos)
X`09`09l = min(lpos+69, rpos)
X`09`09write(1,1020) (seq(i), i=lpos, l)
X1020`09`09format(70a1)
X`09`09lpos = l + 1
X`09enddo
X
X`09close (unit=1)
X`09if(.not.seqinfo) call writef('\nSequence written to %s.\n', outname)
X
X`09stop ' '
X`09end
$ CALL UNPACK TOFASTA.FOR;1 1729870502
$ create 'f'
X1 TOFASTA
X     TOFASTA converts a GCG sequence file into a file with the sequence
X     (or a designated portion of it) in native FastA (Pearson) format.
X
X     This is an enhancement from Stephen Clark (clark@salk.bitnet) for
X     use with programs that require native FastA (Pearson) formatted
X     sequences as input.
$ CALL UNPACK TOFASTA.HLP;1 1446846040
$ v=f$verify(v)
$ EXIT




Newsgroups: bionet.software