Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git] / bench / shootout / revcomp.jruby
blobc00f0234b84a428e63b8a0616eefca22418bb391
1 #!/usr/bin/ruby
2 # The Great Computer Language Shootout
3 # http://shootout.alioth.debian.org/
5 # Contributed by Peter Bjarke Olsen
6 # Modified by Doug King
8 seq=Array.new
10 def revcomp(seq)
11 seq.reverse!.tr!('wsatugcyrkmbdhvnATUGCYRKMBDHVN','WSTAACGRYMKVHDBNTAACGRYMKVHDBN')
12 stringlen=seq.length
13 0.step(stringlen-1,60) {|x| print seq.slice(x,60) , "\n"}
14 end
16 while STDIN.gets
17 if $_ =~ />/
18 if seq.length != 0
19 revcomp(seq.join)
20 seq=Array.new
21 end
22 puts $_
23 else
24 sub(/\n/,'')
25 seq.push $_
26 end
27 end
28 revcomp(seq.join)