FASTA format: Difference between revisions

Added uBasic/4tH version
(FASTA format in Qbasic and True BASIC)
(Added uBasic/4tH version)
Line 2,028:
f: 1;</lang>
 
=={{header|uBasic/4tH}}==
<lang>If Cmd (0) < 2 Then Print "Usage: fasta <fasta file>" : End
If Set(a, Open (Cmd(2), "r")) < 0 Then Print "Cannot open \q";Cmd(2);"\q" : End
 
Do While Read (a) ' while there are lines to process
t = Tok (0) ' get a lime
 
If Peek(t, 0) = Ord(">") Then ' if it's a marker
Print Show (Chop(t, 1)); ": "; Show (FUNC(_Payload(a)))
Continue ' get the payload and print it
EndIf
 
Print "Out of sequence" : Break ' this should never happen
Loop
 
Close a ' close the file
End ' and end the program
 
_Payload ' get the payload
Param (1)
Local (4)
 
b@ = Dup("") ' start with an empty string
 
Do
c@ = Mark(a@) ' mark its position
While Read (a@) ' now read a line
d@ = Tok (0) ' get the line
If Peek (d@, 0) = Ord(">") Then e@ = Head(a@, c@) : Break
b@ = Join (b@, d@) ' marker? reset position and exit
Loop ' if not add the line to current string
 
Return (b@) ' return the string</lang>
{{out}}
<pre>Rosetta_Example_1: THERECANBENOSPACE
Rosetta_Example_2: THERECANBESEVERALLINESBUTTHEYALLMUSTBECONCATENATED
 
0 OK, 0:431 </pre>
=={{header|Wren}}==
{{trans|Kotlin}}
374

edits