FASTA format: Difference between revisions
→version 2: rewritten
(Added Easylang) |
Walterpachl (talk | contribs) (→version 2: rewritten) |
||
(One intermediate revision by the same user not shown) | |||
Line 1,975:
===version 1===
This REXX version correctly processes the examples shown.
<syntaxhighlight lang="rexx">/*REXX program reads a (bio-informational)
If ifid=='' Then
d=''
Do While lines(ifid)\==0
x=strip(linein(ifid),'T') /* read a line (a record) from the input */
/* and strip trailing blanks
if left(x, 1)=='>' then do▼
If left(x,1)=='>' Then Do /* a new file id
Call out /* show output name
name=substr(x,2) /* and get the new (or first)
d=''
End
Else
End
Exit
out:
Say name':' d /* show output name and data */
Return</syntaxhighlight>
{{out|output|text= when using the default input filename:}}
<pre>
Line 2,003 ⟶ 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
name=
data=''
▲$= /*the value of the output file's stuff.*/
Do While
x=strip(linein(iFID),'T') /*read a line (a record) from the file,*/
Select
if left(x, 1)==';' then do▼
When x=='' Then /*
Nop
End
if $\=='' then say name':' $▼
▲ name=substr(x, 2)
If data\=='' Then
Say name':'
name=substr(x,2)
else $=space($ || translate(x, , '*'), 0)▼
data=''
▲ end /*j*/ /* [↓] show output of last file used. */
End
Otherwise
End
End
If data\=='' Then
</syntaxhighlight>
<pre>
'''input:''' The '''FASTA2.IN''' file is shown below:
|