FASTA format: Difference between revisions

FASTA format in BASIC256
(Added XPL0 example.)
(FASTA format in BASIC256)
Line 355:
Rosetta_Example_2: THERECANBESEVERALLINESBUTTHEYALLMUSTBECONCATENATED
</pre>
 
=={{header|BASIC256}}==
<lang BASIC256>open 1, "input.fasta"
 
first = True
 
while not eof(1)
ln = readline(1)
if left(ln, 1) = ">" then
if not first then print
print mid(ln, 2, length(ln)-2) & ": ";
if first then first = False
else
if first then
print "Error : File does not begin with '>'"
exit while
else
if checkNoSpaces(ln) then
print left(ln, length(ln)-2);
else
print "Error : Sequence contains space(s)"
exit while
end if
end if
end if
end while
close 1
end
 
function checkNoSpaces(s)
for i = 1 to length(s) - 1
if chr(mid(s,i,1)) = 32 or chr(mid(s,i,1)) = 9 then return False
next i
return True
end function</lang>
 
=={{header|C}}==
2,130

edits