Created
October 19, 2014 04:08
-
-
Save ivan-krukov/952607b799bafce7e9a3 to your computer and use it in GitHub Desktop.
Calculate codon number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub codon_sequence { | |
my ($self, $n) = @_; | |
my ( $r, @s ); | |
for my $i ( 0 .. 2 ) { | |
$r = $n % 4; | |
$n = $n >> 2; | |
unshift( @s, $nucleotides[$r] ); | |
} | |
return join( '', @s ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment