Skip to content

Commit fc32a50

Browse files
author
L. Grondin
committed
[rosalind] TRAN
1 parent d224698 commit fc32a50

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

rosalind/tran-grondilu.pl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use v6;
2+
3+
given $*IN.slurp {
4+
my @dna;
5+
for m:g/ '>Rosalind_' <.digit>**4 \n ( <[ACGT\n]>+ ) / {
6+
push @dna, $_[0].subst: "\n", '', :g;
7+
}
8+
my ($transitions, $transversions);
9+
for @dna[0].comb Z @dna[1].comb -> $a, $b {
10+
next unless $a ne $b;
11+
if ($a eq 'A'|'G' and $b eq 'G'|'A') or ($a eq 'C'|'T' and $b eq 'C'|'T') {
12+
$transitions++
13+
} else {
14+
$transversions++
15+
}
16+
}
17+
say $transitions/$transversions;
18+
}
19+
20+
# vim: ft=perl6

0 commit comments

Comments
 (0)