Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Translation Substring Errorby johngg (Canon) |
on Nov 09, 2017 at 23:10 UTC ( [id://1203088]=note: print w/replies, xml ) | Need Help?? |
This is not addressing the problem you were having, rather it is a suggestion for a simpler way of initialising your %genetic_code hash that would save some typing. The glob function can be used to generate combinations of letters. Your hash contains 64 keys which are all possible 3-character combinations of A, C, G and T. These can be generated using glob like this ...
Arranging the corresponding amino acid letters in an array allows us to map keys (genetic codes) and values (amino acids) shift'ed from the array together to create the hash lookup.
I hope this is of interest. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|