Skip to content

Commit c16adc3

Browse files
author
L. Grondin
committed
[rosalind] PROB
1 parent 648b159 commit c16adc3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

rosalind/prob-grondilu.pl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use v6;
2+
3+
my @sample = "ACGATACAA
4+
0.129 0.287 0.423 0.476 0.641 0.742 0.783".split: "\n";
5+
6+
my $dna = $*IN.get;
7+
my @A = $*IN.get.split(" ");
8+
9+
sub prob(:$dna, :$gc-content) {
10+
1/2**$dna.chars * [*] map { $_ eq 'G'|'C' ?? $gc-content !! (1 - $gc-content) }, $dna.comb
11+
}
12+
13+
my @B = map { log(prob :$dna, :gc-content($_))/log(10) }, @A;
14+
15+
say @B».fmt: "%.3f";
16+
17+
# vim: ft=perl6
18+

0 commit comments

Comments
 (0)