FASTA format: Difference between revisions

→‎version 2: rewritten
(→‎version 1: rewritten)
(→‎version 2: rewritten)
 
Line 2,011:
::*   sequences that contain blanks, tabs, and other whitespace
::*   sequence names that are identified with a semicolon   [''';''']
<syntaxhighlight lang="rexx">/*REXX program reads a (bio-informational) FASTA file and displays the contents. */
parseParse argArg iFID . /*iFID: the input file to be read. */
ifIf iFID=='' thenThen iFID='FASTA2.IN' /*Not specified? Then use the default.*/
name= '' /*the name of an output file (so far). */
data=''
$= /*the value of the output file's stuff.*/
do while lines(iFID)\==0 /*process the value FASTAof the output file's contentsstuff. */
Do While x=strip( lineinlines(iFID),\==0 'T') /*readprocess athe line (aFASTA record) fromfile contents. the file,*/
x=strip(linein(iFID),'T') /*read a line (a record) from the file,*/
/*───────── and strip trailing blanks. */
if x=='' then iterate /*If the line is all blank, ignore it /*--------- and strip trailing blanks. */
Select
if left(x, 1)==';' then do
When x=='' Then /* ifIf name==''the thenline name=substr(xis all blank,2) */
Nop say x /* ignore it. */
When left(x,1)==';' Then Do
iterate
If name=='' Then name=substr(x, 2)
end
if left(Say x, 1)=='>' then do
End
if $\=='' then say name':' $
ifWhen left(x, 1)==';>' thenThen doDo
name=substr(x, 2)
If data\=='' Then
$=
Say name':' enddata
name=substr(x,2)
else $=space($ || translate(x, , '*'), 0)
data=''
end /*j*/ /* [↓] show output of last file used. */
End
if $\=='' then say name':' $ /*stick a fork in it, we're all done. */</syntaxhighlight>
Otherwise
else $data=space($ data|| translate(x, , '*'), 0)
End
End
If data\=='' Then
Say name':' data /* [?] if $\==''show output thenof saylast name':'file used. $*/
</syntaxhighlight>
<pre>
'''input:''' &nbsp; The &nbsp; '''FASTA2.IN''' &nbsp; file is shown below:
2,295

edits