USING: io io.files io.streams.duplex kernel sequences
sequences.private strings vectors words memoize splitting
-grouping hints unicode.case continuations io.encodings.ascii ;
+grouping hints tr continuations io.encodings.ascii
+unicode.case ;
IN: benchmark.reverse-complement
-MEMO: trans-map ( -- str )
- 256 >string
- "TGCAAKYRMBDHV" "ACGTUMRYKVHDB"
- [ pick set-nth ] 2each ;
-
-: do-trans-map ( str -- )
- [ ch>upper trans-map nth ] change-each ;
-
-HINTS: do-trans-map string ;
+TR: trans-map ch>upper "ACGTUMRYKVHDB" "TGCAAKYRMBDHV" ;
: translate-seq ( seq -- str )
- concat dup reverse-here dup do-trans-map ;
+ concat dup reverse-here dup trans-map-fast ;
: show-seq ( seq -- )
translate-seq 60 <groups> [ print ] each ;
: do-line ( seq line -- seq )
- dup first ">;" memq? [
- over show-seq print dup delete-all
- ] [
- over push
- ] if ;
+ dup first ">;" memq?
+ [ over show-seq print dup delete-all ] [ over push ] if ;
HINTS: do-line vector string ;