Skip to content

Instantly share code, notes, and snippets.

@ivan-krukov
Created October 19, 2014 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan-krukov/952607b799bafce7e9a3 to your computer and use it in GitHub Desktop.
Save ivan-krukov/952607b799bafce7e9a3 to your computer and use it in GitHub Desktop.
Calculate codon number
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