RosettaCodeData/Task/FASTA-format/True-BASIC/fasta-format.basic

35 lines
794 B
Plaintext

DEF EOF(f)
IF END #f THEN LET EOF = -1 ELSE LET EOF = 0
END DEF
FUNCTION checknospaces(s$)
FOR i = 1 TO LEN(s$)-1
IF (s$)[i:1] = CHR$(32) OR (s$)[i:1] = CHR$(9) THEN LET checkNoSpaces = 0
NEXT i
LET checknospaces = 1
END FUNCTION
OPEN #1: NAME "m:\input.fasta", org text, ACCESS INPUT, create old
LET first = 1
DO WHILE (NOT EOF(1)<>0)
LINE INPUT #1: ln$
IF (ln$)[1:1] = ">" THEN
IF (NOT first<>0) THEN PRINT
PRINT (ln$)[2:maxnum]; ": ";
IF first<>0 THEN LET first = 0
ELSEIF first<>0 THEN
PRINT "Error : File does not begin with '>'"
EXIT DO
ELSE
IF checknospaces(ln$)<>0 THEN
PRINT ln$;
ELSE
PRINT "Error : Sequence contains space(s)"
EXIT DO
END IF
END IF
LOOP
CLOSE #1
END