http://shootout.alioth.debian.org/benchmark.php?test=revcomp&lang=all&sort=fullcpu#about
rebol[title: "reverse-complement.r"]
flip: does [
reverse/part :there :here
there: skip :there 60
word: :there
forskip word 61[
there: :word
insert :there "^/"
there: next :there
all[not tail? :here
here: next :here
:there <= :here break
]
]
either tail? :here
[insert :here "^/"]
[if not find/match back :here "^/"[
insert back :here "^/" here: next :here
]]
]
rule: [
here:
["A" (change :here "T")] | ["C" (change :here "G")]|
["G" (change :here "C")] | ["T" (change :here "A")]|
["^/"(remove :here) :here]|
["U" (change :here "A")] | ["M" (change :here "K")]|
["R" (change :here "Y")] | ["Y" (change :here "R")]|
["K" (change :here "M")] | ["V" (change :here "B")]|
["H" (change :here "D")] | ["D" (change :here "H")]|
["B" (change :here "V")] | "W" | "S" | "N" |
[">" (all[:here <> :there flip]
all[not tail? :here here: find/tail next :here "^/"]
):here there:
]
]
set-modes system/ports/input[lines: false binary: false]
fasta: copy system/ports/input
parse fasta[there: some rule (flip)]
insert system/ports/output fasta

--
... nice weather eh

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to