Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Storage of proteins from diferent ORFby frozenwithjoy (Priest) |
on Mar 31, 2014 at 16:35 UTC ( [id://1080426]=note: print w/replies, xml ) | Need Help?? |
Edit: Looks like kennethk also rewrote your code in almost the same way as I was adding my last part, so it must be the right way to do it! :P Edit2: kennethk pointed out to me that my code is incrementing by three positions when there is an unknown codon, but yours only increments by one position. Is this by design? It seems to me like you would want to move on to the next codon regardless of there being a match or mismatch. First, your code would be much more simple if you had your codon table in a hash and just looked up the codon in the hash to get the amino acid. Before you entered the loop, you would define the table:
Second, I'm not really familiar with this usage: @marcos=<,$protein>;I think what you want instead of this line is: push @marcos, $protein;Then if you move your last little loop outside of the main loop, I think it should behave the way you expect. Here is a simplified version of that last loop: print "La secuencia $c es: $_\n\n" for @marcos;Third, I suspect that you aren't using use strict; use warnings;... Use these! I've combined all of these suggestions and made a few more changes to rewrite your code as:
In Section
Seekers of Perl Wisdom
|
|