Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git] / bench / shootout / regexdna.ruby
blobfdd2a413e9d900aa7c17b01ec7c148b8186b1426
1 # The Computer Language Shootout
2 # http://shootout.alioth.debian.org/
4 # contributed by jose fco. gonzalez
5 seq = STDIN.readlines.join
6 ilen = seq.size
8 seq.gsub!(/>.*\n|\n/,"")
9 clen = seq.length
12 /agggtaaa|tttaccct/i,
13 /[cgt]gggtaaa|tttaccc[acg]/i,
14 /a[act]ggtaaa|tttacc[agt]t/i,
15 /ag[act]gtaaa|tttac[agt]ct/i,
16 /agg[act]taaa|ttta[agt]cct/i,
17 /aggg[acg]aaa|ttt[cgt]ccct/i,
18 /agggt[cgt]aa|tt[acg]accct/i,
19 /agggta[cgt]a|t[acg]taccct/i,
20 /agggtaa[cgt]|[acg]ttaccct/i
21 ].each {|f| puts "#{f.source} #{seq.scan(f).size}" }
24 'B' => '(c|g|t)', 'D' => '(a|g|t)', 'H' => '(a|c|t)', 'K' => '(g|t)',
25 'M' => '(a|c)', 'N' => '(a|c|g|t)', 'R' => '(a|g)', 'S' => '(c|t)',
26 'V' => '(a|c|g)', 'W' => '(a|t)', 'Y' => '(c|t)'
27 }.each { |f,r| seq.gsub!(f,r) }
29 puts
30 puts ilen
31 puts clen
32 puts seq.length