IUBio

Combining chopup & reformat- an OpenVMS example

Michael Coyne mjcoyne at warren.med.harvard.edu
Fri Nov 3 16:24:31 EST 1995


Thanks to all who helped me puzzle out how to write the following command
file.  I decided to post it in case it could be helpful to others. 
Remember to include a line like $ chopgcg == "@[whatever-dir]chopgcg" in
your login.com file in order for it to work.

This is written for GCG running under OpenVMS.

In the next version, I'd like to include wildcard support and a check to
see if a file with the same name as the output file already exists.

Have fun...

Mike
mjcoyne at argo.net



$!
$!     CHOPGCG - a new command procedure to reformat flat-file
$!     sequences in one step by passing them first through
$!     the GCG program CHOPUP, and then through REFORMAT.
$!
$!     Revision history:  version 1.0 October 26, 1995
$!
$!     Thanks for helpful suggestions to:
$!
$!     Lynn Miller  (Genetics Computer Group)
$!     Dawn Cushing (Massachusetts General Hospital)
$!     Several readers of the comp.os.vms and bionet.software.gcg newsgroups.
$!
$!
$!
$!     Michael J. Coyne Jr.
$!     Channing Laboratory
$!     mjcoyne at warren.med.harvard.edu
$!
$!
$!
$   say :== write sys$output
$   say ""
$   say "          CHOPGCG:  This program reformats flat ASCII text"
$   say "                    files into GCG format in a single step."
$   say ""
$   say "          Version 1.0       10/26/95      Michael J. Coyne"
$   say ""
$   say ""
$!
$!
$ on Control_y then goto end
$ on error then goto end
$!
$!
$ If P1 .eqs. ""
$ then
$   say ""
$   Inquire  P1 "File to be formatted? "
$   say ""
$   If P1 .eqs. "" Then exit
$ EndIf
$!
$!
$ OrgFileName = P1
$!
$!
$ begin:
$!
$ IsThere = f$search(OrgFileName)
$ CurrentDir = f$directory()
$!
$ If (IsThere .eqs. "")
$  Then
$   say "Sorry, no file called ''OrgFileName' was found"
$   say "in the directory ''CurrentDir'."
$   say ""
$   Inquire  OrgFileName "File to be formatted? "
$   say ""
$!
$     If (OrgFileName .eqs. "")
$      Then
$       exit
$     Else
$       goto begin
$     EndIf
$!
$ Else
$!
$ FileNameLength = (f$locate(".",OrgFileName))
$ FileExtLength = (f$length(OrgFileName) - (FileNameLength+1))
$ ShortFileName = f$extract(0,FileNameLength,OrgFileName)
$!
$ If (FileExtLength .eq. 0)
$   then FileExt = "SEQ"
$   else FileExt = f$extract((FileNameLength+1),FileExtLength,OrgFileName)
$ EndIf
$!
$ ChopFileName = "''ShortFileName'"+".CHOP"
$ FinalFileName = "''ShortFileName'"+".SEQ"
$!
$ Chopup /in='OrgFileName' /out='ChopFileName' /def
$ Reformat /in='ChopFileName' /out='FinalFileName' /def
$ Delete/nolog 'ChopFileName';*
$!
$ say ""
$ say "The file ''OrgFileName' has been reformatted for use with GCG."
$ say ""
$ say "The GCG formatted version has been saved as ''FinalFileName'"
$ say "in the directory ''CurrentDir'"
$ say ""
$!
$ EndIf
$ exit



More information about the Info-gcg mailing list

Send comments to us at biosci-help [At] net.bio.net