Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[rosalind] EVAL
  • Loading branch information
grondilu committed Dec 7, 2012
1 parent a19c36f commit dd782ef
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions rosalind/eval-grondilu.pl
@@ -0,0 +1,22 @@
use v6;

sub prob(:$dna, :$gc-content) {
1/2**$dna.chars *
[*] map { $_ eq 'G'|'C' ?? $gc-content !! (1 - $gc-content) }, $dna.comb
}

my @data = $*IN.lines; # '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;


# vim: ft=perl6

0 comments on commit dd782ef

Please sign in to comment.