RosettaCodeData/Task/FASTA-format/11l/fasta-format.11l
2023-07-01 13:44:08 -04:00

25 lines
594 B
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

V FASTA =
|>Rosetta_Example_1
THERECANBENOSPACE
>Rosetta_Example_2
THERECANBESEVERAL
LINESBUTTHEYALLMUST
BECONCATENATED
F fasta_parse(infile_str)
V key =
V val =
[(String, String)] r
L(line) infile_str.split("\n")
I line.starts_with(>)
I key !=
r [+]= (key, val)
key = line[1..].split_py()[0]
val =
E I key !=
val = line
I key !=
r [+]= (key, val)
R r
print(fasta_parse(FASTA).map((key, val) -> #.: #..format(key, val)).join("\n"))