限制性酶切位点的预期数量
作者:L. Grondin
http://rosalind.info/problems/eval/
示例输入
10 AG 0.25 0.5 0.75
示例输出
0.422 0.563 0.422
源代码: eval-grondilu.pl
use v6; sub prob(:$dna, :$gc-content) { 1/2**$dna.chars * [*] map { $_ eq 'G'|'C' ?? $gc-content !! (1 - $gc-content) }, $dna.comb } my @data = ('10', 'AG', '0.25 0.5 0.75'); my $n = @data.shift; my $s = @data.shift; my @A = @data.shift.split: ' '; my @B; for @A -> $gc-content { push @B, ($n - $s.chars + 1) * prob :dna($s), :$gc-content; } say @B.fmt("%.3f");