Anonymous user
FASTA format: Difference between revisions
My solution using Common Lisp
(My solution using Common Lisp) |
|||
Line 401:
(print (format "%n%s: " (subs line 1)))
(print line)))))</lang>
=={{header|Common Lisp}}==
<lang lisp>;; * The input file as a parameter
(defparameter *input* #p"fasta.txt"
"The input file name.")
;; * Reading the data
(with-open-file (data *input*)
(loop
:for line = (read-line data nil nil)
:while line
;; Check if we have a comment using a simple test instead of a RegEx
:if (char= #\> (char line 0))
:do (format t "~&~a: " (subseq line 1))
:else
:do (format t "~a" line)))</lang>
{{out}}
<pre>Rosetta_Example_1: THERECANBENOSPACE
Rosetta_Example_2: THERECANBESEVERALLINESBUTTHEYALLMUSTBECONCATENATED</pre>
=={{header|Crystal}}==
If you want to run below code online, then paste below code to [https://play.crystal-lang.org/#/cr <b>playground</b>]
|